Dear R users,

I am trying to converting a piece of my SAS code into R code, and I have met
some difficulties which I couldn't figure out. The SAS code looks like this:

proc mixed CL method=ml data = wholedata  covtest;
class site year tissue species fish_id;
model fishSe = waterSe  / outp=predict solution;
random intercept / sub=site;
repeated tissue/ sub=fish_id type=cs;
run;

Basically,  I am trying to fit a random intercept linear mixed model to
allow each *site *to have a different intercept and I also want to specify a
variance-covariance structure (CS for example) within each *fish (fish_id) .
*I do not know how can I fit this model with correct R code. I tried
*lme* function
included in the *nlme *package, with R code:

lme(fixed=y~x,random=~1|site,correlation = corCompSymm(form = ~1|fishid),
na.action=na.omit, method="REML")

but R gave me error message like this:    Incompatible formulas for groups
in "random" and "correlation"

I heard I can use the *nlme* function to have both the random and
correlation statements together. I wonder how can I write the correct syntax
to fit my model under *nlme *? I really have no clue about that.... I will
be highly appreciated if anyone can give me any advice on this issue. Thank
you in advance!


Zhiwei

	[[alternative HTML version deleted]]


