lmeForm {BIOdry}R Documentation

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)

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.

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

Value

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

Author(s)

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

References

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

Examples

##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)

[Package BIOdry version 0.9 Index]