[R] cross random effects

Deepayan Sarkar deepayan at stat.wisc.edu
Wed Aug 4 22:25:32 CEST 2004


On Wednesday 04 August 2004 01:13 pm,   wrote:
> Dear friends,
>
> I have asked last few days about cross-random effects
> using PQL, but I have not receive any answer because
> might my question was not clear.
>
> My question was about analysing the salamander mating
> data using PQL. This data contain cross-random effects
> for (male) and for (female). By opining MASS and lme
> library. I wrote this code

Firstly, these are packages, not libraries. Secondly, there's no package 
called lme (but I'm guessing you are talking about nlme).

> sala.glmm <- glmmPQL(fixed=y~WSf*WSM,
> random=list(experiment=pdBlocked(list(pdIdent(~randf-1),pdIdent(~randm-1)))
>), family=binomial, data=sala.data).
>
> Where
> data neame=sala.glmm which contain
>  y is response
>  wsf is fixed effect
>  wsm is fixed effects
>  randf  is random effect
>  random is random effect
>
> The data contain three experiments at the same time.
> The previous cod is work but it does not give me
> accurate result especially for the random effects.

This is a bit vague. How are you judging accuracy?

> For experiment I wrote this code
>
> experiment <-
> factor(c(rep(1,120),rep(2,120),rep(3,120)))
>  because I have three experiments at the same time,
> but if I change the experiment to e.g
>
> experiment <- factor(c(rep(1,360)))
>
> is still give answer but is not the right answer. So,
> I am accusing my specification of the experiment
> (group). If you have any suggestion pleas let me know.

It's difficult to suggest anything without knowing more about your data. What 
exactly do the variables randf and randm represent? If you really need 
crossed random effects (and it's not clear from what you have told us that 
you do), you might try the GLMM() function in the lme4 package. 

Deepayan




More information about the R-help mailing list