On 10/03/15 19:23, Luis wrote:
> Hi everyone,
>
> I'm trying to estimate the scale parameter of a gamma distribution considering a link function with covariables as the shape parameter, but I have a problem with the logGamma function, apparently the obtained values for this function are negative, I have tried changing the initial values of the parameters and the values of the prior distributions but the problem is still the same
>
> I would really appreciate if there is any suggestion to make this work
The prior for beta1 has the median at 0, so 50% of the mass is negative.
A nicer approach would be use a link function:
log(alpha.1[i,j]) <- beta1 + beta2*T[j] + beta3*Vi[j]
Also, the first parameter of dgamma() is the shape parameter, not the
scale, so you might want the following instead:
x[i,j] ~ dgamma(beta, alpha.1[i,j])
Bob
> Here is the code with the data
>
> model{
> for(i in 1:n)
> {
> for(j in 1:m)
> {
> x[i,j] ~ dgamma(alpha.1[i,j], beta)
> alpha.1[i,j]<-beta1*exp(beta2*T[j])*exp(beta3*Vi[j])
>
> }
> }
> beta ~ dgamma(0.01, 0.01)
> beta1 ~ dnorm(0.0, 0.0000001)
> beta2 ~ dnorm(0.0, 0.0000001)
> beta3 ~ dnorm(0.0, 0.0000001)
>
> }
> #Inits
> inits=list(beta= 1, beta1=1, beta2=1, beta3=1)
>
> #Data
> list(T=c(0.364,0.545,0.727,0.773,0.909,1,0.818),
> Vi=c(1,1,1,1,1,1,1), n=15, m=7,
> x= structure(
> .Data = c(
> 0.0141, 0.0182, 0.0016, 0.0021, 0.0089, 0.009, 0.002,
> 0.0031, 0.0172, 0.0075, 0.0011, 0.0024, 0.0025, 0.008,
> 0.11, 0.0069, 0.007, 0.03, 0.0001, 0.0001, 0.0001,
> 0.003, 0.002, 0.008, 0.003, 0.0005, 0.0006, 0.009,
> 0.001, 0.0121, 0.0008, 0.0031, 0.0005, 0.0005, 0.001,
> 0.011, 0.005, 0.0009, 0.0261, 0.0084, 0.0085, 0.0022,
> 0.017, 0.0012, 0.0007, 0.0001, 0.0015, 0.0016, 0.001,
> 0.0259, 0.0161, 0.0104, 0.0105, 0.012, 0.0001, 0.0001,
> 0.003, 0.008, 0.0051, 0.0719, 0.0009, 0.0009, 0.0003,
> 0.008, 0.0012, 0.0159, 0.0319, 0.0105, 0.0106, 0.002,
> 0.014, 0.0043, 0.0728, 0.0549, 0.0015, 0.0016, 0.003,
> 0.006, 0.001, 0.012, 0.002, 0.0035, 0.0036, 0.0099,
> 0.021, 0.0008, 0.0013, 0.0163, 0.0033, 0.0034, 0.008,
> 0.005, 0.001, 0.002, 0.005, 0.004, 0.004, 0.008,
> 0.0004, 0.001, 0.0011, 0.0012, 0.0004, 0.0005, 0.0039),
> .Dim = c(15, 7)))
>
>
> Thanks in advance & have a great day
>
>
> Luis Rodriguez
>
> -------------------------------------------------------------------
> This list is for discussion of modelling issues and the BUGS software.
> For help with crashes and error messages, first mail [log in to unmask]
> To mail the BUGS list, mail to [log in to unmask]
> Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
> Please do not mail attachments to the list.
> To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
> If this fails, mail [log in to unmask], NOT the whole list
--
Bob O'Hara
Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany
Tel: +49 69 7542 1863
Mobile: +49 1515 888 5440
WWW: http://www.bik-f.de/root/index.php?page_id=219
Blog: http://blogs.nature.com/boboh
Journal of Negative Results - EEB: www.jnr-eeb.org
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|