[R-sig-ME] unequal spacing in repeated measures

Gi-Mick Wu mick.wu at mail.mcgill.ca
Wed Apr 15 15:03:58 CEST 2009


________________________________________
From: r-sig-mixed-models-bounces at r-project.org [r-sig-mixed-models-bounces at r-project.org] On Behalf Of r-sig-mixed-models-request at r-project.org [r-sig-mixed-models-request at r-project.org]
Sent: April 15, 2009 6:00 AM
To: r-sig-mixed-models at r-project.org
Subject: R-sig-mixed-models Digest, Vol 28, Issue 17

Send R-sig-mixed-models mailing list submissions to
        r-sig-mixed-models at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
or, via email, send a message with subject or body 'help' to
        r-sig-mixed-models-request at r-project.org

You can reach the person managing the list at
        r-sig-mixed-models-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."


Today's Topics:

   1. Re: LME and nonlinearity? (Rob Robinson)
   2. Numerical methods used to compute correlation     coefficients (H c)
   3. unequal spacing in repeated measures (Matthew P. Dekar)
   4. Re: Numerical methods used to compute correlation
      coefficients (Douglas Bates)
   5. Re: unequal spacing in repeated measures (Ben Bolker)


----------------------------------------------------------------------

Message: 1
Date: Tue, 14 Apr 2009 11:14:35 +0100
From: "Rob Robinson" <rob.robinson at bto.org>
Subject: Re: [R-sig-ME] LME and nonlinearity?
To: " 'Bal?zs Lest?r' " <ebszolocsucsor at freemail.hu>
Cc: r-sig-mixed-models at r-project.org
Message-ID: <8630D3CE8B5B4B7D829344B946BD3573 at btodomain.bto.org>
Content-Type: text/plain;       charset="iso-8859-1"

>  3.)        Do I need a non-linear model?
>

Probably not. As others have pointed out, models need only be linear in
their (transformed) parameters, they can model highly non-linear
relationships. Non-linear models are not linear in their parameters and
cannot be transormed so (the wikipedia page on nonlinear regression might
help in understanding the difference). Before progressing further it sounds
like you need to think carefully about the mechanism behind the relationship
you are trying to model. How is the non-linearity generated? this might help
in thinking the best model to fit. For exploratory purposes gams or splines
might help characterise the pattern (try gamm in mgcv). I'm not sure fitting
higher-order polynomials is really helpful as it's hard to think of what
would generate a quartic, quintic, ... (or even cubic) relationship. If
there's some sort of threshold in the response, then converting to a
factorial variable might help.
Hope that helps
Cheers
rob

*** Help us celebrate 100 yrs of Ringing http://btoringing.blogspot.com/ **

Dr Rob Robinson, Principal Ecologist
British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
Ph: +44 (0)1842 750050     E: rob.robinson at bto.org
Fx: +44 (0)1842 750030     W: www.bto.org/aboutBTO/cvs/rob_robinson.htm

====== "How can anyone be enlightened, when truth is so poorly lit" =======


> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf
> Of Bal?zs Lest?r
> Sent: 09 April 2009 22:14
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] LME and nonlinearity?
>
> Dear All,
>
> I have a mixed model (LME), but one of my explanatory
> variables is not linearly related to the dependent variable.
>
>  1.)     Somebody told me, to make a 2 or 3 level factor from
> the continuous variable. (I wouldn't prefer this)
>
>   2.)     I saw in some statistical books that in these
> cases, I have to use in the model the quadratic term of the
> variable. (but the AIC is much greater than with the
> factorized variable)
>
> OR
>
>  Is that possible, to use a poly() function in the lme? (this
> model seems to be the best, based on AIC).
>
>
> I'm a bit confused, 'cause the LME supposes linear relation
> between variables. Isn't it right?
>
>  3.)        Do I need a non-linear model?
>
> Which solution is the best?
>
>
> Regards,
> Balazs
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



------------------------------

Message: 2
Date: Tue, 14 Apr 2009 10:20:05 -0400
From: H c <harlancampbell at gmail.com>
Subject: [R-sig-ME] Numerical methods used to compute correlation
        coefficients
To: r-sig-mixed-models at r-project.org
Message-ID:
        <222824550904140720qacc8580g98b1a889ca837712 at mail.gmail.com>
Content-Type: text/plain

I have have already posted the following question:  What numerical methods
are used in nlme to estimate correlation parameters?
I was referred to the Pinheiro and Bates book.  Unfortunately, on p. 202,
section 5.1.1, under the title "Estimation and Computational Methods", no
description on a numerical method is provided.  (When the data is
transformed to work with the profiled likelihood(y->ystar), one needs the
parameters that define Lambda.  How are these parameters estimated?)

Any help is always appreciated,

Harlan

        [[alternative HTML version deleted]]



------------------------------

Message: 3
Date: Tue, 14 Apr 2009 10:03:13 -0500
From: "Matthew P. Dekar" <mdekar at uark.edu>
Subject: [R-sig-ME] unequal spacing in repeated measures
To: r-sig-mixed-models at r-project.org
Message-ID: <e789c499ec24.49e45f61 at uark.edu>
Content-Type: text/plain; charset=us-ascii

I would appreciate any advice in regards to the handling of unequal spacing in repeated measures regression with mixed models.  I sampled crayfish with funnel traps and measured environmental predictor variables monthly for two years in 12 stream pools.  Data are presented in terms of the average number of crayfish per trap per pool (response variable = catch-per-unit-effort = cpue).  However, the sampling interval was not fixed so I created a continuous time variable (day) indicating the number of days elapsed from the first sampling occasion (1,35,55,...,643).  As an example, I modeled cpue in a repeated measures framework with a single predictor variable (stream temperature = temp), pool as the subject/random variable, and day was included using a spatial covariance structure (Exponential = corExp) in lme following:

cpu1<-lme(cpue~temp, random=~1 | pool, data=CPU, method = "ML")
cpu2<- update(cpu1, correlation = corExp(form=~day))

Is this an appropriate usage of spatial covariance structures?  Can the above analysis be replicated in lmer?  Thanks very much for your time.

Matthew Dekar

Arkansas Cooperative Fish & Wildlife Research Unit
Department of Biological Sciences
University of Arkansas
Fayetteville, AR 72701
(479) 575-6360



------------------------------

Message: 4
Date: Tue, 14 Apr 2009 11:37:58 -0500
From: Douglas Bates <bates at stat.wisc.edu>
Subject: Re: [R-sig-ME] Numerical methods used to compute correlation
        coefficients
To: H c <harlancampbell at gmail.com>
Cc: r-sig-mixed-models at r-project.org
Message-ID:
        <40e66e0b0904140937n268340a6maa2fbe1c56fe33f8 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Apr 14, 2009 at 9:20 AM, H c <harlancampbell at gmail.com> wrote:
> I have have already posted the following question: ?What numerical methods
> are used in nlme to estimate correlation parameters?
> I was referred to the Pinheiro and Bates book. ?Unfortunately, on p. 202,
> section 5.1.1, under the title "Estimation and Computational Methods", no
> description on a numerical method is provided. ?(When the data is
> transformed to work with the profiled likelihood(y->ystar), one needs the
> parameters that define Lambda. ?How are these parameters estimated?)

I'm not sure what you mean by "correlation parameters".  If you mean
the correlation parameters in the unconditional distribution of the
random effects then those are estimated by maximum likelihood (ML) or
residual maximum likelihood (REML).  The profiled deviance or the
profiled REML criterion is evaluated with respect to a transformed set
of parameters and this value is optimized.



------------------------------

Message: 5
Date: Tue, 14 Apr 2009 14:12:17 -0400
From: Ben Bolker <bolker at ufl.edu>
Subject: Re: [R-sig-ME] unequal spacing in repeated measures
To: "Matthew P. Dekar" <mdekar at uark.edu>,       R Mixed Models
        <r-sig-mixed-models at r-project.org>
Message-ID: <49E4D201.3010903 at ufl.edu>
Content-Type: text/plain; charset=ISO-8859-1

Matthew P. Dekar wrote:
> I would appreciate any advice in regards to the handling of unequal
> spacing in repeated measures regression with mixed models.  I sampled
> crayfish with funnel traps and measured environmental predictor
> variables monthly for two years in 12 stream pools.  Data are
> presented in terms of the average number of crayfish per trap per
> pool (response variable = catch-per-unit-effort = cpue).  However,
> the sampling interval was not fixed so I created a continuous time
> variable (day) indicating the number of days elapsed from the first
> sampling occasion (1,35,55,...,643).  As an example, I modeled cpue
> in a repeated measures framework with a single predictor variable
> (stream temperature = temp), pool as the subject/random variable, and
> day was included using a spatial covariance structure (Exponential =
> corExp) in lme following:
>
> cpu1<-lme(cpue~temp, random=~1 | pool, data=CPU, method = "ML")
> cpu2<- update(cpu1, correlation = corExp(form=~day))
>
> Is this an appropriate usage of spatial covariance structures?  Can
> the above analysis be replicated in lmer?  Thanks very much for your
> time.
>

  You should use correlation=corCAR1(form=~day) for a continuous
time covariate.

  You can't do this in lmer (yet, or for a while) -- Doug Bates has
stated that implementing correlation structures a la nlme is lower
on his list than working out other issues.

  good luck,
   Ben Bolker

------------------------------

In the mean time, the function "geeglm" may do the job if the interest is in temperature (fixed effects at the population level) rather than specific differences among pools (random effect being only noise). 

The correlation structure among repeated observations can be specified with a "waves" argument to account for different sampling intervals.
Example with an auto-regressive correlation structure:
cpu1<-geeglm(cpue~temp, id=pool, corstruc="ar1", waves="day", data=CPU)

hope this helps,
Mick
ps is stream temperature constant throughout the sampling period?
pps This is my first attempt to help on the list, so feel free to correct me... (hopefully I will get better at it some day)




More information about the R-sig-mixed-models mailing list