[R] Mixed model

Spencer Graves spencer.graves at pdf.com
Mon Jun 20 16:54:03 CEST 2005


(comments in line)

Stephen wrote:
> Dear Fellow R users,
> 
>  
> 
> I am fairly new to R and am currently conducting a mixed model.
> 
>  
> 
> I have 7 repeated measures on a simulated clinical trial 
> 
>  
> 
> If I understand the model correctly, the outcome is the measure (as a
> factor) the predictors are clinical group and trial (1-7). The fixed
> factors are the measure and group. The random factors are the intercept
> and id and group.
> 
>  
> 
> Based on this
> 
> Dataset <- read.table("C:/Program Files/R/rw2010/data/miss/model1.dat",
> header=TRUE, sep="\t", na.strings="NA", dec=".", strip.white=TRUE)
> 
> require (nlme)
> 
> model.mix <- lme (trans1 ~ Index1 + grp, 
>                   random = ~ constant | id / grp ,
>                   data = Dataset,
>                   na.action = "na.exclude")

	  I'm not familiar with this syntax.  I would replace your "random" 
formula with "~1|id/grp".  Did you get sensible results from your 
attempt to compute "model.mix"?  How do the results compare with the 
results from replacing your "random" with "~1|id/grp"?  Also, I'd try 
the same thing with lmer;  please see "Fitting Linear Mixed Models in R" 
by Doug Bates in the latest R News, downloadable from 
"www.r-project.org" -> Newsletter.
> 
>  
> 
> # where trans1 is the factor of the repeated measures of the scale.
> 
> # Index is the trial number, grp the group, and id the subject number.
> 
>  
> 
> I would like to split the results, just like SPSS splitfile by a
> variable in the Dataset called runnb
> 
> I have tried using:
> 
>  
> 
>       by (Dataset, runnb, 
> 
>             function (x) (lme (trans1 ~ Index1 + grp, 
> 
>             random = ~ constant | id / grp ,
> 
>             data = Dataset,
> 
>             na.action = "na.exclude") )
> 
> )
> 
	  I haven't used "by" enough to comment on this.  If I had problems 
with something like this, I might do something like the following:

	  with(Dataset, table(runnb, id, grp))

	  Do you have enough observations in all cells to be able to estimate 
all these individual models?  If yes, I might proceed as follows:

	  b.lvls <- table(Dataset$runnb)
	  nb <- length(b.lvls)
	  fit <- vector(mode="list", nb)
	  for(i in 1:nb)
		    fit[[i]] <- lme(...)	
	
	  If I still had problems with this, I might manually step through this 
until I found the "i" that created the problem, etc.
>  
> 
> but to no avail . as my computer hangs and I set my GUI to --mdi
> --max-mem-size=1200M.
> 
>  
> 
> Any ideas as to how to splitfile the results SPSS style would be most
> appreciated?
> 
>  
> 
> Also, does lme do pairwise deletion?
> 
>  
> 
> By the way
> 
> 
>>version
> 
> 
> platform i386-pc-mingw32
> 
> arch     i386           
> 
> os       mingw32        
> 
> system   i386, mingw32  
> 
> status                  
> 
> major    2              
> 
> minor    1.0            
> 
> year     2005           
> 
> month    04             
> 
> day      18             
> 
> language R    
> 
> Windows XP Pro.
> 
>  
> 
> Many thanks
> 
> Stephen
> 
> Ps as its my first time on this group - neat program!
> 
> 
> ???? ?"? ???? ????
> http://mail.nana.co.il
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list