On Sat, 2008-03-08 at 08:07 -0600, Douglas Bates wrote:
> On Sat, Mar 8, 2008 at 2:57 AM, Alexandra Bremner
> <alexandra.bremner at uwa.edu.au> wrote:
> > I am attempting to model data with the following variables:
> > timepoint - n=48, monthly over 4 years
> > hospital - n=3
> > opsn1 - no of outcomes
> > total.patients
> > skillmixpc - skill mix percentage
> > nurse.hours.per.day
> > Aims
> > To determine if skillmix affects rate (i.e. no.of.outcomes/total.patients).
> > To determine if nurse.hours.per.day affects rate.
> > To determine if rates vary between hospitals.
> > There is first order autoregression in the data. I have attempted to use the lmer function (and lmer2) with correlation structure and weights:
> > test1 <-lmer(opsn1~timepoint+as.factor(hospital)+ skillmixpc + nursehrsperpatday +(timepoint|hospital) +offset(log(totalpats)),family=poisson, data=opsn.totals)
> > test2 <-lmer(opsn1~timepoint+as.factor(hospital)+ skillmixpc + nursehrsperpatday +(timepoint|hospital)+offset(log(totalpats)),family=poisson, data=opsn.totals, correlation=corAR1(form=~1|hospital))
> > test3 <-lmer(opsn1~timepoint+as.factor(hospital)+ skillmixpc + nursehrsperpatday +(timepoint|hospital)+offset(log(totalpats)),family=poisson, data=opsn.totals, correlation=corAR1(form=~1|hospital),weights=varIdent(form=~1|hospital))
>
> You are mixing arguments for lme or nlme into a call to lmer. Because
> the weigths argument doesn't have the form required by lmer you get an
> error message. The effect of the correlation argument is more subtle
> - because lmer has ... in the argument list your correlation
> specification is absorbed without an error message but it has no
> effect.
>
> The lmer documentation doesn't say that you can use the forms of the
> correlation and weights arguments from the lme function, although you
> are not the first person to decide that it should. :-)
The documentation for weights in lmer references lm. It looks to me like
the weights argument for lm requires a vector of weights a priori - does
that mean lmer cannot estimate heteroscedasticity like lme can?