Learn R Programming

BIOdry (version 0.9)

lmeForm: LME formula

Description

This function computes LME formulas from multilevel ecological data series (MEDS).

Usage

lmeForm(rd, prim.cov = FALSE, resp = NULL, covar = NULL, lev.rm = NULL)

Value

formula with any of the forms: resp ~ cov | group or ~ cov.

Arguments

rd

data.frame. Multilevel ecological data series

prim.cov

Logical: should the LME formula only be printed in primary covariate form: '~ cov'? If FALSE then a complete form: 'resp ~ covar | group' is formulated.

resp

NULL or character. Column name of the response. If NULL then the name of the first numeric column of the MEDS is used.

covar

NULL or character. Column name(s) of the covariate(s). If NULL then the name of the first time-unit column in the MEDS is used.

lev.rm

NULL, character or numeric vector of levels in the MEDS to be removed from the groups.

Author

Wilson Lara <wilarhen@gmail.com>, Felipe Bravo <fbravo@pvs.uva.es>

Details

Formulas of the form resp ~ cov | group (see groupedData function) are computed from MEDS. The formulas can be implemented by modelFrame function to detrend MEDS

References

Pinheiro J. C., D. M. Bates. 2000. Mixed-effects models in S and S-PLUS. Springer, New York.

Examples

Run this code
##Multilevel ecological data series of tree-ring widths:
data(Prings05,envir = environment())

## LME formula:
form1 <- lmeForm(Prings05,prim.cov = FALSE)
print(form1)
## removing the sample level from the formula
form2 <- lmeForm(Prings05,lev.rm = 'sample')
form2 <- lmeForm(Prings05,lev.rm = 1)

## groupedData object with the LME formula 
gdata <- groupedData(lmeForm(Prings05,lev.rm = 1),
                     data = Prings05)
plot(gdata,groups = ~ sample)

Run the code above in your browser using DataLab