[R] question for bayesian regression
Derya Sahin
deryassahin at gmail.com
Thu Jan 21 15:19:46 CET 2016
Hello,
I don't have much knowledge about how to use JAGS to do bayesian
regression, I have seen several examples but my data is left censored and I
am not sure how to construct the likelihood function, if someone could post
a sample JAGS code for bayesian regression for left-censored data, that
would be great. for example I want to predict y and my predictors x1,x2,x3 such
that y ~a1*x1+a2*x2+a3*x3 and x3 is left censored some values are below LOD
values (LOD is also a vector, same size of x3)
for left-censored data x3, I know I can do the following,
# JAGS for left censored x3
model {
for (i in 1:N) {
above.lod[i] ~ dinterval(x3[i], llodVec[i])
x3[i] ~ dnorm(mu, tau)
}
mu ~ dnorm(0, .001)
tau <- 1/pow(sigma,2)
sigma~dt(0,1/625,1)
}
but where and how I should include the regression . In short I want to
combine the above and below code in one jags code, since I am new to JAGS
not sure what I am doing is correct. I appreciate any help and suggestions.
thanks,
#JAGS for regression
for( i in 1:N ) {
y[i] ~ dnorm( y.hat[i] , tau )
y.hat[i] <- a1*x1[i]+a2*x2[i]*a3*x3[i]
}
tau <- 1/pow(sigma,2)
sigma ~ dunif( 0 , 10 )
for ( j in 1:3 ) {
a[j] ~ dnorm( 0 , 1.0E-3 )
}
}
regression <http://stats.stackexchange.com/questions/tagged/regression>
bayesian <http://stats.stackexchange.com/questions/tagged/bayesian> jags
<http://stats.stackexchange.com/questions/tagged/jags>
In short, I am not sure how to construct the likelihood function for this
kind of problem,
any help would be appreciated
thanks
--
D
[[alternative HTML version deleted]]
More information about the R-help
mailing list