Hello all,
I am conducting a randomization test on a given dataset. One of the
covariates, gender, is randomly assigned 1000 times to create a
randomization dataset (rand.data). To these 1000 datasets, I fit a full
model (see below) and the aim is to generate a distribution of LRT statistic
under the null. Here are some of the questions I have:
1. I am using for() loop to fit the dataset grouped according to
rand.id(1:1000). If there is an error in fitting one dataset, the loop
terminates prematurely. My question is how to make the loop to continue? I
tried using try() in SPLUS but did not work for me. May be I did not
understand the implementation properly.
2. Is there any other efficient way to do this?
The Loop I am using-
library(nlme)
for (i in 1:nsets)
{
od.fit<-nlme(MODEL, # NLME MODEL gender as a
covariate
data=rand.data, # Data to be used for
fitting
fixed=......~1, #Three fixed effects
parameters
random=...~1|id, #Random variability on two
parameters with subjects grouped by "id"
start=c(..,..,..), #Initial estimates for 3
fixed effects
subset=trial==i) #Fit the NLME function by trial
rand.loglik[i,]<-matrix(od.fit$logLik) #Extract
loglikelihood
}
I don't mind if the solution is applicable in R or Splus.
Thanks,
Pravin
Pravin Jadhav
[[alternative HTML version deleted]]