Learn R Programming

BIOdry (version 0.4)

modelFrame: MEDS modeling

Description

This function develops recursive modeling and/or LME detrending of multilevel ecological data series (MEDS).

Usage

modelFrame(rd, lv = list(2, 1, 1), fn = list("rtimes", "scacum", "amod"), form = NULL, ...)

Arguments

rd
data.frame. Multilevel ecological data series.
lv
List of numeric positions in the factor-level columns of the processed MEDS to implement the one-level functions, or character names of the factor-level columns.
fn
List of character names of the one-level functions to be recursively implemented (see details).
form
character or NULL. Name of an LME formula to be used in residual subtraction. Two methods are available: 'lmeForm' or 'tdForm'. These methods implement functions with the same names (see lmeForm and tdForm). If NULL then the lme modeling is not developed.
...
Further arguments to be evaluated by one-level or lme functions (see details).

Value

form argument, either MEDS or lme object.

Details

Diverse one-level functions are recursively implemented. Processed MEDS can also be detrended with lme models and other nlme methods. Default arguments produce modeling of tree growth from dendrochonological MEDS with recursive implementation of rtimes, scacum, amod, and frametoLme functions. Nevertheless, other functions can be implemented (see example with climatic data). Internal algorithm uses arguSelect and ringApply functions. Consequently, arguments not to be vectorized should be specified in 'MoreArgs' lists (see example). Objects of type modelFrame can further be modified with update function.

References

Lara W., F. Bravo, D. Maguire. 2013. Modeling patterns between drought and tree biomass growth from dendrochronological data: A multilevel approach. Agric. For. Meteorol., 178-179:140-151.

Examples

Run this code

##Multilevel data frame of tree-ring widths:
data(Prings05,envir = environment())
## Radial increments measured on 2003:
data(Pradii03,envir = environment())    
## Climatic records of monthly precipitations and temperatures
data(PTclim05,envir = environment())

## Modeling tree growth:
ar <- modelFrame(Prings05,
                 y = Pradii03,
                 form = 'tdForm',
                 MoreArgs = list(only.dup = TRUE,
                                 mp = c(1,1),
                                 un = c('mm','cm'),z = 2003))
head(ar$resid)
summary(ar$model)    
##a plot of the tree-growth fluctuations:
d <- groupedData(lmeForm(ar$resid,lev.rm = 1),data = ar$resid)
plot(d,groups = ~ sample,auto.key = TRUE)

## Modeling aridity:
cf <- modelFrame(rd=PTclim05,
                 lv = list('year','year'),
                 fn = list('moveYr','wlai'),
                 form = 'lmeForm')
head(cf$resid)
##a plot of the aridity fluctuations:
dc <- groupedData(lmeForm(cf$resid),data = cf$resid)
plot(dc, auto.key = TRUE)

Run the code above in your browser using DataLab