[R-sig-eco] Doing repeated measures on a randomized block design
Pedro Pequeno
p@co||pe @end|ng |rom gm@||@com
Sun Jun 16 22:20:19 CEST 2019
Dear Rick,
I believe the error occurs because the "time" covariate in the correlation
structure cannot have repeated values; these functions assume that you have
a single observation for each time step. The simplest solution is to create
a time variable that counts time as half-days, so that the two "Exposure"
values within the same day have different values for the time variable.
Alternatively, you could use one of R's spatial correlatiom structures
(i.e. by treating your time series as a transect), which I think do not
have this restriction.
Hope this helps.
Pedro
Em domingo, 16 de junho de 2019, Richard Boyce <boycer using nku.edu> escreveu:
> Dear Pedro,
>
> Thanks so much! Your comments got me headed in right direction.
>
> First, I converted Dates to a day-of-year format and sorted by Date.
>
> Second, I gave it a group structure, using:
>
> fvfm <- groupedData(FvFm ~ Date | Tree/Exposure, perm.fvfm)
>
> head(fvfm)
> Grouped Data: FvFm ~ Date | Tree/Exposure
> Tree Exposure Date FvFm
> 1 1 N 44 0.7950
> 2 1 S 44 0.7750
> 3 1 N 51 0.7790
> 4 1 S 51 0.6980
> 5 1 N 58 0.7725
> 6 1 S 58 0.6475
>
> I needed to nest Exposure in Tree, otherwise I got the following error
> when running the GLS:
>
> Error in Initialize.corAR1(X[[i]], ...) :
> covariate must have unique values within groups for "corAR1" objects
>
> Then I ran GLS as:
>
> gls.fvfm<-gls(FvFm ~ Exposure, correlation = corAR1(form = ~Date|Tree/
> Exposure), data = perm.fvfm);summary(gls.fvfm)
>
> which gave me:
>
> Generalized least squares fit by REML
> Model: FvFm ~ Exposure
> Data: perm.fvfm
> AIC BIC logLik
> -306.1793 -294.356 157.0896
>
> Correlation Structure: ARMA(1,0)
> Formula: ~Date | Tree/Exposure
> Parameter estimate(s):
> Phi1
> 0
>
> Coefficients:
> Value Std.Error t-value p-value
> (Intercept) 0.7780694 0.009153179 85.00538 0.0000
> ExposureS -0.0214861 0.012944549 -1.65986 0.0991
>
> Correlation:
> (Intr)
> ExposureS -0.707
>
> Standardized residuals:
> Min Q1 Med Q3 Max
> -4.0182078 -0.3630604 0.2468685 0.6717131 2.0139322
>
> Residual standard error: 0.0776673
> Degrees of freedom: 144 total; 142 residual
>
> I’m interpreting this to mean that Exposure is marginally significant,
> with S < N (which is what I’ve observed).
>
> Once again, much thanks!
>
> Rick
>
> On Jun 16, 2019, at 9:45 AM, Pedro Pequeno <pacolipe using gmail.com> wrote:
>
> Dear Richard,
>
> your question could be handled using a linear model incorporating a
> temporal autcorrelation structure within trees. However, I don't think
> using "tree" as random factor (e.g. in lme()) would be very helpful here
> because random factors assume a compound symmetry autocorrelation structure
> (same correlation for any temporal distance), which is probably overly
> simplistic for long time series. Instead, you could use Generalized Least
> Squares, gls() in R, which is a standard choice in such cases. For instance:
>
> gls(FvFm ~ Exposure, correlation = corAR1(form = ~time|Tree), data =
> perm.fvfm)
>
> This will fit a model assuming a first-order autoregressive correlation
> structure, i.e. residual autocorrelation should decrease as the temporal
> distance between them increases. Notice that "time" should be the temporal
> order of observations within trees, so you will have to convert your "Date"
> to this format first. For other correlation structures, relevant R
> functions and examples similar to yours, see Zuur et al. (2009), "Mixed
> effects models and extensions in ecology with R".
>
> Best wishes,
>
> Pedro
>
> Em sex, 14 de jun de 2019 às 14:42, Richard Boyce <boycer using nku.edu>
> escreveu:
>
>> I’m measuring chlorophyll fluorescence (FvFm), my measured variable, on N
>> and S exposures (treatment variable) of 4 red cedar trees. Here’s what the
>> beginning of the data file looks like:
>>
>> head(perm.fvfm).
>>
>> Tree Exposure Date FvFm
>> 1 1 S 13.Feb 0.775
>> 2 1 N 13.Feb 0.795
>> 3 2 S 13.Feb 0.737
>> 4 2 N 13.Feb 0.759
>> 5 3 S 13.Feb 0.615
>> 6 3 N 13.Feb 0.712
>>
>> If I were just doing this one time, this would be a randomized block
>> design, where trees were the blocks (random variable) and exposure was the
>> treatment variable (fixed variable). Actually, since there are only two
>> treatment levels, it would be a paired t-test.
>>
>> However, I’ve repeated this on many dates (18 so far this year). So this
>> also requires a repeated-measures design, with trees as subjects.
>>
>> Repeated-measures, however, usually have time (date) as a within-subject
>> variable and then some other treatment that is a between-subjects variable.
>> I don’t have have a between-subjects variable, however, as all subjects
>> (trees) get both levels of exposure and all levels of time (date).
>>
>> I’ve searched the web, but there is not a lot out there for this kind of
>> design. It looks like lm, lme, lmer, and permuco in R might all work, but
>> advice for how to set up the Error() or random variable designations are
>> confusing and sometimes contradictory. Any advice would be much appreciated!
>>
>> Thanks,
>> Rick Boyce
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
> ================================
> Richard L. Boyce, Ph.D.
> Professor
> Associate Editor, Journal of the Torrey Botanical Society
> Department of Biological Sciences, SC 150
> Northern Kentucky University
> Nunn Drive
> Highland Heights, KY 41099 USA
>
> 859-572-1407 (tel.)
> 859-572-5639 (fax)
> boycer using nku.edu
> http://www.nku.edu/~boycer/
> =================================
>
> "One of the advantages of being disorderly is that one is constantly
> making exciting discoveries." - A.A. Milne
>
>
>
>
>
>
>
>
>
>
>
>
[[alternative HTML version deleted]]
More information about the R-sig-ecology
mailing list