Hello again,
Thanks to the people who noted that my constants for the loops were wrong.
Unfortunately, that was only a typo error for the email (sorry!). I still
get the same 'postcondition violated' message with the corrected loops. The
re-edited program is below.
Thanks again,
Patrick
##program##
model weibull;
#time-to-event for 500 subjects. subjects have a max of 4 events.
const
N=500, # number of subjects
M=4, # number of repeated events
obs=1590; # total number of obs in the dataset - not everyone has all 4 events
var
id[obs], # subject:1 to 500
t[obs], # failure time
tcens[obs], # censoring time
mu[obs], r, # Weibull parameters
subject[N], # random effect for subects
tau, sigma2, # precision of random effects, var=1/(tau)
treat[obs], # covariate: treat=0 or 1
alpha, beta.treat; # regression coeffs
data id, t, tcens, treat in "c:\my documents\bugs\simul\weib\wtc101.dat";
inits in "c:\my documents\bugs\simul\weib\weib.in";
{
for (i in 1:obs) {
# Survival times bounded below by censoring times:
t[i] ~ dweib(r,mu[i]) I(tcens[i],);
log(mu[i]) <- alpha + beta.treat*treat[i] + subject[id[i]];
}
# Random effects:
for(j in 1:N) {
subject[j] ~ dnorm(0.0, tau);
}
# Priors:
alpha ~ dnorm(0.0, 0.00001);
beta.treat ~ dnorm(0.0, 0.00001);
tau ~ dgamma(0.000001, 0.000001);
r ~ dgamma(1, 0.000001);
sigma2 <- 1/(tau); # variance of random effects
}
#inital values
list(beta.treat = 0, alpha = 0, r=1, tau=1)
@..@ @..@ @..@ @..@
(----) (----) (----) (----)
( >__< ) ( >__< ) ( >__< ) ( >__< )
""" """ """ """ """ """ """ """
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|