Package 'BIOdry'

Title: Multilevel Modeling of Dendroclimatical Fluctuations
Description: Multilevel ecological data series (MEDS) are sequences of observations ordered according to temporal/spatial hierarchies that are defined by sample designs, with sample variability confined to ecological factors. Dendroclimatic MEDS of tree rings and climate are modeled into normalized fluctuations of tree growth and aridity. Modeled fluctuations (model frames) are compared with Mantel correlograms on multiple levels defined by sample design. Package implementation can be understood by running examples in modelFrame(), and muleMan() functions.
Authors: Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>
Maintainer: Wilson Lara <[email protected]>
License: GPL-3
Version: 0.9
Built: 2024-11-26 03:20:48 UTC
Source: https://github.com/cran/BIOdry

Help Index


Multilevel Modeling of Dendroclimatical Fluctuations

Description

Multilevel ecological data series (MEDS) are sequences of observations ordered according to temporal/spatial hierarchies that are defined by sample designs, with sample variability confined to ecological factors. Dendroclimatic MEDS of tree rings and climate are modeled into normalized fluctuations of tree growth and aridity. Modeled fluctuations (model frames) are compared with Mantel correlograms on multiple levels defined by sample design. Package implementation can be understood by running examples in modelFrame(), and muleMan() functions.

Details

The DESCRIPTION file:

Package: BIOdry
Type: Package
Title: Multilevel Modeling of Dendroclimatical Fluctuations
Version: 0.9
Author: Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>
Date: 2022-05-02
Maintainer: Wilson Lara <[email protected]>
Description: Multilevel ecological data series (MEDS) are sequences of observations ordered according to temporal/spatial hierarchies that are defined by sample designs, with sample variability confined to ecological factors. Dendroclimatic MEDS of tree rings and climate are modeled into normalized fluctuations of tree growth and aridity. Modeled fluctuations (model frames) are compared with Mantel correlograms on multiple levels defined by sample design. Package implementation can be understood by running examples in modelFrame(), and muleMan() functions.
License: GPL-3
Depends: nlme, ecodist
LazyData: TRUE
NeedsCompilation: no
Packaged: 2022-05-02 19:30:45 UTC; wilar
Date/Publication: 2022-05-02 19:52:02 UTC
Config/pak/sysreqs: libglpk-dev libxml2-dev
Repository: https://wilarhen.r-universe.dev
RemoteUrl: https://github.com/cran/BIOdry
RemoteRef: HEAD
RemoteSha: a8c849bb7b577debcabe177afde5d9ed9232f8a4

Index of help topics:

BIOdry-package          Multilevel Modeling of Dendroclimatical
                        Fluctuations
PTclim05                Multilevel data set of monthly cumulative
                        precipitations and monthly average temperatures
Pchron                  Tree-ring width (TRW) chronology
Pradii03                Vector of radii measured on P.pinaster
Prec                    Cumulative precipitations
Prings05                Multilevel data set of P. pinaster
Temp                    Average temperatures
amod                    Allometric scaling.
anova.modelFrame        Compare modelFrame objects
arguSelect              Argument selection
cClass                  Column-class extraction.
frametoLme              LME modeling
levexp                  Vector releveling
lmeForm                 LME formula
mUnits                  Metric system
modelFrame              Dendroclimatic-fluctuations modeling
moveYr                  Seasonal years
muleMan                 Multilevel dendroclimatic correlograms
plot.modelFrame         Plot modelFrame objects
plot.muleMan            Plot muleMan objects
plot.wlai               Plot an wlai object
ringApply               Multilevel apply
rtimes                  Time-units synchronization
scacum                  Cummulative-scaled sums
shiftFrame              MEDS formatting
slitFrame               Multilevel splitting
summary.modelFrame      summarize a modelFrame object
tdForm                  ltd formulas
wlai                    Walter-Lieth aridity index

Maintainer: Wilson Lara <[email protected]>

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>


Allometric scaling.

Description

Allometric models and parameters are used to scale organic growth.

Usage

amod(x, mp = c(1, 1), fun = y ~ a * (x^b))

Arguments

x

numeric vector.

mp

numeric. Allometric parameters. Default c(1,1) (see details).

fun

formula. Allometric model. To properly specify other formulas, the variables (e.g. x and y) should belong to letters[20:26].

Details

. Allometric models are useful to scale size-components of organisms such as tree diameters (mp = c(2,1)) and basal areas (mp = c(0.25 * pi,2)). Several parameter groups (c(a1,b1,a2,b2, ..., an,bn)) can be recursively processed. This enables computation of complex organic variables. For example, above-ground tree biomass could be computed from two parameter groups for tree-biomass, and over-bark diameter scaling.

Value

data.frame of the scaled variable (x) and relative increments (csx). These are computed with setdiff function.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

## Simulating TRW records:
set.seed(1)
trw <- ts(abs(rnorm(12,1,1)),start = 1950)
## Cumulative TRW:
cri <- cumsum(trw)
## tree diameters
td <- amod(cri,mp = c(2,1))
## plot of the tree diameters and the
## relative increments:
plot(ts(td))

Compare modelFrame objects

Description

Models in modelFrame lists are compared with anova.lme method.

Usage

## S3 method for class 'modelFrame'
anova(object, ..., test, type, adjustSigma, Terms, 
    L, verbose)

Arguments

object

an object inheriting from class "modelFrame".

...

other optional fitted model objects inheriting from classes "modelFrame", "lme", "lm", among other (see anova.lme).

test

optional character string specifying the type of sum of squares to be used in F-tests for the terms in the model (see anova.lme).

type

optional character string specifying the type of sum of squares to be used in F-tests for the terms in the model (see anova.lme).

adjustSigma

If TRUE and the estimation method used to obtain object was maximum likelihood, the residual standard error is multiplied by sqrt(nobs/(nobs - npar)), converting it to a REML-like estimate (see anova.lme).

Terms

optional integer or character vector specifying which terms in the model should be jointly tested to be zero using a Wald F-test (see anova.lme).

L

optional numeric vector or array specifying linear combinations of the coefficients in the model that should be tested to be zero (see anova.lme).

verbose

optional logical value. If TRUE, the calling sequences for each fitted model object are printed with the rest of the output, being omitted if verbose = FALSE (see anova.lme).

Value

data frame inheriting from class "anova.lme".

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

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

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function)
 
 trwf <- modelFrame(Pchron,
                    to = 'cm',
                    MoreArgs = list(mp = c(2,1, biom_param)),
                    log.t = FALSE,
                    on.time = FALSE)
     
## Fitting a single linear regression of the "tdForm" formula
## without random effects to the tree-biomass data:
 
 trwfl <- lm(log(x) ~ log(csx) + year,
             data = trwf$'model'$'data')
 
## Comparing model likelihoods with anova method:
 
     anova(trwf, trwfl)

Argument selection

Description

Arguments of specific functions are selected from arbitrary numbers and varieties of arguments.

Usage

arguSelect(rd = NULL, fun = c("mapply", "ringApply"), ...)

Arguments

rd

NULL or data.frame. Multilevel ecological data series. If NULL then this argument is ignored.

fun

character or NULL. Vector of function names.

...

Further arguments not necessarily contained in the processed function(s).

Details

Closures with ellipsis terms use this function to extract and pass arguments to other functions. Arguments in MoreArgs lists are also extracted and stored again as MoreArgs lists.

Value

list of selected arguments.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##Multilevel ecological data series of tree-ring widths:
data(Prings05,envir = environment())
## Radial increments measured on 2003:
data(Pradii03,envir = environment())    

## Selection of arguments in some functions:
ar1 <- arguSelect(fun = c('amod'),
                  only.dup = TRUE,
                  mp = c(0.5,1),
                  rf.t = 2003)
str(ar1)

ar2 <- arguSelect(fn = 'amod',
                  only.dup = TRUE,
                  mp = c(0.5,1),
                  rf.t = 2003)
str(ar2)
ar3 <- arguSelect(rd = Prings05,
                  fn = 'amod',
                  only.dup = TRUE,
                  mp = c(0.5,1),
                  rf.t = 2003)
str(ar3)

ar4 <- arguSelect(rd = Prings05,
                  fun = 'scacum',
                  sc.c = Pradii03,
                  MoreArgs = list(only.dup = TRUE,
                                  mp = c(0.5,1),
                                  rf.t = 2003))
str(ar4)

ar5 <- arguSelect(rd = Prings05,
                  fun = 'scacum',
                  ref = Pradii03,
                  rf.t = rep(2003:2011),
                  MoreArgs = list(only.dup = TRUE,
                                  mp = c(0.5,1)))
str(ar5)

Column-class extraction.

Description

Column names of multilevel data sets are extracted according to three classes: numeric values, integer sequences, and factor levels.

Usage

cClass(rd, cl = "all")

Arguments

rd

data.frame. Multilevel data series.

cl

character or NULL. Character vector of classes to be considered. These can be 'numeric', 'integer', or 'factor'. If 'all' then all column names of rd are extracted.

Value

character names.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##Multilevel data frame of tree-ring widths:
data(Prings05,envir = environment())
## Names of variables in Prings05 data containing numeric classes:
cClass(Prings05, 'numeric') # 'x'
## Names of variables containing time units: 
cClass(Prings05, 'integer') # 'year'
## Names of variables containing factors: 
cClass(Prings05, 'factor') # 'sample', 'tree', 'plot'

LME modeling

Description

LME models are fitted to detrend multilevel ecological data series.

Usage

frametoLme(rd, form = "lmeForm", res.data = TRUE, ...)

Arguments

rd

data.frame. Multilevel ecological data series.

form

character. Any of two lme formulas: 'lmeForm' and 'tdForm' (see details).

res.data

logical. Save residuals as a multilevel ecological data series. If TRUE then a data frame of name 'fluc' is added to output list.

...

Further arguments to be passed to lme function or to the lme formula in form.

Details

This function implements lme function to fit linear mixed-effects models on multilevel ecological data series processed by the modelFrame function. Two kind of model formulas can be fitted: 'lmeForm' and 'tdForm'; these characters implement functions with same names (tdForm and lmeForm). Other lme formulas can be specified by modifying arguments in any of these two functions. After the lme models are fitted, they can be extended by implementing methods in nlme package.

Value

groupedData object.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

References

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

Examples

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function)
 
 trwf <- modelFrame(Pchron,
                    to = 'cm',
                    MoreArgs = list(mp = c(2,1, biom_param)),
                    log.t = FALSE,
                    on.time = FALSE)
 
## Detrending the fluctuations by fitting a (l)td-form model
## with Maximum-likelihood method (ML):
 
 pdata <- trwf$'model'$'data'
 rlme <- frametoLme(pdata,
                    form = 'tdForm',
                    method = 'ML',
                    log.t = TRUE)
 summary(rlme$model)
 
##a plot of the modeled fluctuations:
 
 d <- groupedData(lmeForm(rlme$fluc,lev.rm = 1),data = rlme$fluc)
 plot(d,groups = ~ sample,auto.key = TRUE)
 
## A model of aridity:
 
 cf <- modelFrame(PTclim05,
                  lv = list('year','year'),
                  fn = list('moveYr','wlai'),
                  form = NULL)
 summary(cf)
 
## An lme model of aridity at 'plot' level:
 
 cdata <- cf$'model'$'data'
 rmod <- frametoLme(cdata,form = 'lmeForm')
 summary(rmod$model)
 rk <- groupedData(lmeForm(rmod$fluc),data=rmod$fluc)
 plot(rk,ylab = 'detrended AI')

Vector releveling

Description

Expansion or reduction of a numeric vector by matching its level names with the ecological factors of a multilevel ecological data series.

Usage

levexp(x, levels)

Arguments

x

numeric vector with names of the vector representing the levels to be matched.

levels

data.frame. Multilevel ecological data series, or character vector of levels.

Value

numeric vector with expanded/reduced levels.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##Multilevel ecological data series of tree-ring widths:
data(Prings05,envir = environment())
## tree radii measured at 2003:
data(Pradii03,envir = environment())    

## Releveling the tree radii
refs <- levexp(Pradii03,Prings05)
refs

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 <[email protected]>, Felipe Bravo <[email protected]>

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)

Dendroclimatic-fluctuations modeling

Description

This function develops recursive evaluation of functions for one-level modeling (FOLM) and LME detrending of dendroclimatic chronologies.

Usage

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

Arguments

rd

data.frame or list. Dendroclimatic chronology or Multilevel ecological data series.

fn

list. Names of the functions for one-level modeling to be recursively implemented.

lv

list. numeric positions in the factor-level labels of rd to implement the one-level functions. If rd is a MEDS, then character names of the factor-level columns.

form

character or NULL. Name of a detrending formula. Two in-package methods are available: the default tdForm or lmeForm.

...

Further arguments in mUnits, or in the functions for one-level modeling, or in the lme function/methods, or in the detrending formula.

Details

Defaults model fluctuations in tree-ring width chronologies via recursive implementation of four FOLM: rtimes, scacum, amod, and frametoLme. Nevertheless, other FOLM can be implemented to model aridity-index fluctuations(see example with climatic data). Processed chronologies are detrended with lme function and other nlme methods . Internal algorithm uses shiftFrame arguSelect and ringApply functions. Consequently, arguments that are not iterated over factor-level labels in the processed data are specified in 'MoreArgs' lists (see examples). Arguments in modelFrame objects can be updated with update function.

Value

Threefold list with fluctuations in fluc, groupedData object in model, and model call in call.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

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

##TRW chronology (mm) and inside-bark radii
    data(Pchron,envir = environment())
    
    ## Parameters of allometric model to compute Diameter at Breast
    ## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
    ## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
    ## et. al. 2013):
    biom_param <- c(2.87, 0.85, 0.05, 2.5)

    ## Modeling tree-biomass fluctuations while accounting for
    ## within-plot source variability (see defaults in "modelFrame"
    ## function)
     
     trwf <- modelFrame(Pchron,
                        to = 'cm',
                        MoreArgs = list(mp = c(2,1, biom_param)),
                        log.t = FALSE,
                        on.time = FALSE)
 
    ## Climatic records:
    data(Temp,envir = environment())
    data(Prec,envir = environment())
    ## Aridity-index fluctuations:
     
     aif <- modelFrame(rd = list(Prec, Temp),
                       fn = list('moveYr','wlai'),
                       lv = list('year','year'),
                       form = 'lmeForm')
     summary(aif$'model')

Seasonal years

Description

Monthly records in time-series replicates (usually of climate) are labeled for the years can begin in a month other than January.

Usage

moveYr(cd, ini.mnt = "Oct")

Arguments

cd

data.frame. Multilevel ecological data series or numeric vector of repeated years with vector names belonging to month.abb.

ini.mnt

character, or numeric from 1 to 12. Initial month of the seasonal year. If character then the months are built-in constants in R-package base. Default 'Oct' makes the years begin in October, for example.

Details

character months as defined in month.abb or month.name.

Value

data.frame object with the months being numeric values and the years beginning at ini.mnt argument.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

## Climatic records of monthly precipitation sums and monthly
## average temperatures
data(PTclim05,envir = environment())

## Making the year 1955 in plot 'P16106' to begin on 'April'
cl1 <- slitFrame(PTclim05,c('year','plot'))[[1]]
cl2 <- moveYr(cl1,ini.mnt = 'Mar')
head(cl2)

## a simple vector of years
yr <- rep(2005,12)
names(yr) <- month.abb[1:12]
moveYr(yr)

Multilevel dendroclimatic correlograms

Description

Multivariate correlograms between TRW fluctuations and climatic fluctuations.

Usage

muleMan(rd, cd, rd.var = NULL, cd.var = NULL, ...)

Arguments

rd

dataframe or groupedData. TRW fluctuations such as that produced by modelFrame.

cd

dataframe or groupedData. Aridity-index fluctuations such as that produced by modelFrame.

rd.var

character or NULL. Column name of the TRW fluctuations to be compared. If NULL then the first column is processed.

cd.var

character or NULL. Column name of the aridity-index fluctuations to be compared. If NULL then the first column is used.

...

Further arguments in mgram

Details

Function mgram in package ecodist is implemented to compare the dendroclimatic fluctuations. Models being compared should have common higher-level factors (see example).

Value

data.frame object of multivariate correlations.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

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

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function)
 
 trwf <- modelFrame(Pchron,
                    to = 'cm',
                    MoreArgs = list(mp = c(2,1, biom_param)),
                    log.t = FALSE,
                    on.time = FALSE)
 
## Climatic Records:
data(Temp,envir = environment())
data(Prec,envir = environment())
## Aridity-index fluctuations:
 
     aif <- modelFrame(rd = list(Prec, Temp),
                       fn = list('moveYr','wlai'),
                       lv = list('year','year'),
                       form = 'lmeForm')
 
##Multivariate comparison:
 
 mcomp <- muleMan(trwf,
                     aif,
                  nperm = 10^3)
 str(mcomp)

Metric system

Description

This function control metric units.

Usage

mUnits(x, from = "mm", to = "mm")

Arguments

x

numeric vector.

from

character. Initial metric unit.

to

character. Final metric unit.

Details

Characters in from and to arguments have the form 'p_', where 'p' is the metric prefix and '_' is a base unit. Sixteen metric prefixes are supported: atto 'a', femto 'f', pico 'p', nano 'n', micro 'mm', mili 'm', centi 'c', deci 'd', deca 'da', hecto 'h', kilo 'k', mega 'M', giga 'G', tera 'T', peta 'P', and exa 'E'.

Value

numeric vector.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

## Simulation of TRW data
set.seed(1)
w <- abs(rnorm(12,1,1))
trw <- ts(w,start = 1970)
## transforming metric units of trw vector from milimeters to meters
sr <- mUnits(trw, from = 'mm', to = 'm')
attributes(sr)

Tree-ring width (TRW) chronology

Description

TRW chronology for Pinus pinaster forests from two sample plots in northern Spain (Soria) and east-central Spain (Cuenca). The data set contains eight TRW series. To account for source variability, two trees were selected per site, and two samples were extracted from each tree.

Usage

data(Pchron)

Format

data.frame object with eight columns.

Rows

Row names of the data set are time-units labels (years of formation).

Columns

Column names represent levels in three within-stand ecological factors that are common to most TRW data and represent variability in stand qualities (stand), tree-radial morphology (sample), and tree genetics/phenotypes (tree). The names are dot-separated labels representing the hierarchy of the three ecological factors, where higher ecological-factor levels are defined first and lower levels after. For example, code 'P16106.17.a' is the column name of sample replicate 'a' in tree '17' in plot 'P16106'.

Details

This data set belongs to a more extensive tree-ring chronology which was processed in previous studies (Bogino and Bravo, 2008) by measuring TRW in polished-core samples (5 mm diameter) using the Windendro program and cross-dating the tree-ring chronologies using COFECHA software. Time units for the TRWs are formation years spanning from 1861 to 2005. The cross-dating records suggested that maritime pine chronologies had high SNR: (23-28 in northern Spain, and 38-61 in east-central Spain) and high EPS (0.96 in northern Spain, and 0.98 in east-central Spain).

References

Bogino, S., and Bravo, F. (2008). Growth response of Pinus pinaster Ait. to climatic variables in central Spanish forests. Ann. For. Sci. 65, 1-13.

Examples

str(Pchron)

Plot modelFrame objects

Description

Diagnostic Trellis plot for fluctuations in modelFrame objects are obtained.

Usage

## S3 method for class 'modelFrame'
plot(x, ...)

Arguments

x

An object inheriting from class modelFrame.

...

further arguments passed to the Trellis plot function.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function)
 
     trwf <- modelFrame(Pchron,
                        to = 'cm',
                        MoreArgs = list(mp = c(2,1, biom_param)),
                        log.t = FALSE,
                        on.time = FALSE)
     plot(trwf, grid = FALSE)

Plot muleMan objects

Description

Diagnostic Trellis plot for fluctuations in muleMan objects are obtained.

Usage

## S3 method for class 'muleMan'
plot(x, ...)

Arguments

x

An object inheriting from class muleMan.

...

further arguments passed to the Trellis plot function.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function):
 
 trwf <- modelFrame(Pchron,
                    to = 'cm',
                    MoreArgs = list(mp = c(2,1, biom_param)),
                    log.t = FALSE,
                    on.time = FALSE)
 
## Climatic Records:
data(Temp,envir = environment())
data(Prec,envir = environment())
## Aridity-index fluctuations:
 
     aif <- modelFrame(rd = list(Prec, Temp),
                       fn = list('moveYr','wlai'),
                       lv = list('year','year'),
                       form = 'lmeForm')
 
##Multivariate comparison:
 
 mcomp <- muleMan(trwf,
                     aif,
                  nperm = 10^3)

 plot(mcomp, grid = FALSE)

Plot an wlai object

Description

A Walter-Lieth climate diagram is produced.

Usage

## S3 method for class 'wlai'
plot(x, ...)

Arguments

x

vector or data.frame. An object inheriting from class wlai, representing the Aridity Index.

...

logical. Further arguments passed to plot function.

Details

Areas between temperature and precipitation lines when precipitation exceeds temperature (moist seasons) are plotted in gray color, and areas where temperature exceeds precipitation (dry seasons) are plotted in black color. Monthly cumulative precipitations over 100 mm are scaled such that 1 degree C of average temperature is equal to 5 mm of precipitation.

Value

A plot of the Walter-Lieth diagram.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

References

Manrique E., A. Fernandez-Cancio. 2000. Extreme climatic events in dendroclimatic reconstructions from Spain. Clim. Chang., 44: 123-138.

Examples

##random simulation of climatic records
set.seed(1)
pr <- rnorm(12,1,1)
tm <- rnorm(12,0,1)
cld <- data.frame(pr,tm)
##labels of months from october to september
rownames(cld) <- month.abb[c(10:12,1:9)]
rownames(cld) <- c(10:12,1:9)
##computation of the aridity index and climate diagram
AI <- wlai(cld)
plot.wlai(AI)

Vector of radii measured on P.pinaster

Description

Vector of radii measured in dominant trees of P.pinaster (2003) growing on the Ebro river basin, Spain

Usage

data(Pradii03)

Format

A numeric vector with names of the vector indicating the measured tree.

Details

This vector contains inside-bark radii, measured in four trees during 2003 (mm). This radial vector was derived from the over-bark diameters at breast height (cm), with allometric estimation of inside-bark diameters from the over-bark diameters. Names of the vector correspond to labels at tree level

Source

Sustainable Forest Management Research Institute, Universidad de Valladolid (UVa)-INIA.

Examples

str(Pradii03)

Cumulative precipitations

Description

Monthly cumulative precipitation (mm).

Usage

data(Prec)

Format

data.frame object with 24 records.

Column

Column names contain plot codes and monthly abbreviations

Details

Recorded months begin at January and end at December, and observed years span from 1951 to 2005. Factor in data set defines one sample level (plot)

References

Bogino, S., and Bravo, F. (2008). Growth response of Pinus pinaster Ait. to climatic variables in central Spanish forests. Ann. For. Sci. 65, 1-13.

Examples

str(Prec)

Multilevel data set of P. pinaster

Description

Radial increments of Pinus pinaster from two sample plots located on Northern and Southern portions of Ebro river basin, Spain.

Usage

data(Prings05)

Format

A data frame with the following 5 variables.

x

A numeric vector with the radial increments in mm year-1

year

A numeric vector with the recorded year

sample

A factor indicating the sample replicate

tree

A factor indicating the tree number

plot

A factor indicating the plot code

Details

This data set contains eight series of tree-ring widths of maritime pine (Pinus pinaster), with recorded years spanning from 1810 to 2005. The cores were sampled from dominant trees of two sites, with sample plots being located on both: northern Spain (plot code: P44005) and center-east portion of the same country (plot code: P16106). Two trees were selected by plot, and two core samples were extracted by tree. Consequently, the sample design defined three levels: sample in tree on plot (plot level), sample in tree (tree level), and sample level.

References

Bogino, S., and Bravo, F. (2008). Growth response of Pinus pinaster Ait. to climatic variables in central Spanish forests. Ann. For. Sci. 65, 1-13.

Examples

str(Prings05)

Multilevel data set of monthly cumulative precipitations and monthly average temperatures

Description

Monthly precipitation sums and average temperatures of two climatic locations.

Usage

data(PTclim05)

Format

A data frame with the following 5 variables.

pr

A numeric vector with the monthly cumulative precipitations (mm month-1)

tm

A numeric vector with the monthly average temperatures (degree C month-1)

month

A numeric vector of months

year

A numeric vector of years

plot

A factor vector of plot codes

Details

Recorded months begin at January and end at December, and observed years span from 1951 to 2005. Factor in data set defines one sample level (plot)

References

Bogino, S., and Bravo, F. (2008). Growth response of Pinus pinaster Ait. to climatic variables in central Spanish forests. Ann. For. Sci. 65, 1-13.

Examples

str(PTclim05)

Multilevel apply

Description

Wrapper of Map to apply functions on multilevel data series and preserve factor-level structure in the outputs.

Usage

ringApply(rd, lv = 1, fn = "scacum", ...)

Arguments

rd

data.frame. Multileve ecological data series.

lv

numeric position, or character name, of an ecological factor in the processed MEDS.

fn

character name of the function to be evaluated (see details). Default 'scacum' computes scaled-cumulative radii.

...

Further arguments in the function being specified fn argument (see details)

Details

Other functions such as rtimes, scacum, amod, or wlai can be implemented. Function arguments should be formulated as suggested in mapply, with constant arguments being stored in a MoreArgs list. This function is implemented by modelFrame for recursive modeling of MEDS.

Value

data.frame object preserving initial factor-level columns.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

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

##Multilevel ecological data series (MEDS) of tree-ring widths:
data(Prings05,envir = environment())
## Radial increments measured on 2003:
data(Pradii03,envir = environment())    
## MEDS of monthly precipitation sums and average temperatures:
data(PTclim05,envir = environment())

##Tree-level scaling of years of formation
##with 'rtimes' function:
dfm1 <- ringApply(Prings05,
                  lv = 2,
                  fn = 'rtimes')
str(dfm1)
##Relative time-units from year 1 to year 9:
subset(dfm1,time%in%c(1:9,NA))

## Sample-level scaling of TRW chronologies around reference radii
## which were measured at 2003:
dfm2 <- ringApply(dfm1,
                  lv = 'sample',
                  sc.c = Pradii03,
                  rf.t = 2003,
                  fn = 'scacum')
str(dfm2)    
##Sample-level modeling of basal areas (mm2) via allometric
##scaling:
dfm3 <- ringApply(dfm2,
                  lv = 'sample',
                  fn = 'amod',
                  MoreArgs = list(mp = c(2,1,0.25 * pi,2)))
str(dfm3)

## Seasonal years from 'October' to 'September':
cl1 <- ringApply(PTclim05,
                 lv = 'year',
                 fn = 'moveYr')
tail(cl1,15)

##Year-level aridity indexes: 
wl <- ringApply(cl1,
                lv = 'year',
                fn = 'wlai')
str(wl)

## Plot of aridity-index fluctuations:
d <- groupedData(lmeForm(wl),wl)
plot(d)

Time-units synchronization

Description

Unique observations in time-series replicates are excluded

Usage

rtimes(x, only.dup = TRUE)

Arguments

x

multilevel ecological data series containing a column of time units, or numeric vector with names representing the time units.

only.dup

logical. Extract only duplicated times. If TRUE then unique times are replaced with NA. If all computed times are unique then this argument is ignored.

Value

data.frame object with the initial vector and its time units.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

## row names of a vector
fy <- function(y,span){(y - span):y}
x <- c(fy(2005,5),fy(2007,10)) 
## (not run) Simulating the vector
r <- abs(rnorm(length(x)))
names(r) <- x
## (not run) computing the synchronized times:
rtimes(r,only.dup = TRUE)        
## (not run) Extracting only duplicated times:
na.omit(rtimes(r,only.dup = TRUE))

Cummulative-scaled sums

Description

This function computes cummulative and scaled sums of time-series replicates.

Usage

scacum(x, sc.c = NA, rf.t = NA)

Arguments

x

numeric vector of time-series replicates with names of the vector being time units.

sc.c

numeric constant. Scaling constant. If NA then the computed cumulative sums are not scaled.

rf.t

NA, or numeric constant. Reference time of the scaling constant. If NA then maximum time in vector-name range is used.

Details

Cummulative sums of time-series replicates (e.g. tree-ring widths) are scaled around reference values (e.g. tree radii).

Value

data frame with the original vector, and its scaled-cummulative sums.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

x <- c(0.79,0.32,0.53,0.43,0.18)
names(x) <- 1948:1952
scacum(x,sc.c = 4,rf.t = 1951)

##If sc.c = NA then cummulative values are scaled arround
##max(cumsum(x)):
max(cumsum(x))
scacum(x,NA,1951)

MEDS formatting

Description

dendroclimatic chronologies (trw, and climatic data) are formatted into multilevel ecological data series. SI units of continuous variables in the data can be transformed.

Usage

shiftFrame(rd, f.nm = NULL, x.nm = names(rd)[1L], t.nm = "year", 
    ...)

Arguments

rd

data.frame or list. Dendroclimatic chronology DC (see details) or list of two DCs (e.g. precipitation and temperature records), or multilevel ecological data series (MEDS).

f.nm

character vector. In the case of formatting ring-data frames, column names of the factors in the new MEDS. If NULL then this argument is recycled from attributes in rd. If such an attribute is also NULL then a sequence of codes (F1, F2, ..., Fn) is used.

x.nm

character. In the case of formatting MEDS, name of the variable to be reshaped. Default uses name of first variable of rd.

t.nm

character.In the case of formatting MEDS, name of the time-units variable .

...

Further arguments in mUnits.

Details

Row names of dendroclimatic data frames are time units (e.g. years). Column names are dot-separated labels representing the hierarchy of ecological or time-units factors, where the higher levels are defined first and the lower levels after. For example, code 'P16106.17' is the column name of core 'a' in tree '17' in plot 'P16106'. Labels containing monthly abbreviations are also formatted.

Value

When rd argument is a dendroclimatic chronology (see details) then the output is a groupedData object, and viceversa.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##tree-ring widths formated as a groupedData object:
data(Prings05,envir = environment())

## Formatting the groupedData object into a ring-data frame:
pwide <- shiftFrame(Prings05, from = 'mm', to = 'mmm')
str(pwide)
## Formatting the ring-data frame into a groupedData object, and
## changing SI units from micrometers to milimeters:
plong <- shiftFrame(pwide,from = 'mmm', to = 'mm')
plot(plong)

Multilevel splitting

Description

This function splits a Multilevel data frame into factor levels.

Usage

slitFrame(rd, lv = cClass(rd, "factor"))

Arguments

rd

data.frame object with factor-level columns.

lv

Numeric or character. Position number in the factor-level columns of rd, or correspondant column name to split the data. If the spliting column is not a factor, the character name of the column should be used.

Value

list of data.frame objects.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##Ring data frame:
##Multilevel data frame of tree-ring widths:
data(Prings05, envir = environment())
data(PTclim05, envir = environment())
## split multilevel data into its second factor-level column:
spl <- slitFrame(Prings05)
str(spl)
## split the data into the factor-level: 'year':
spl <- slitFrame(Prings05,'year')
str(spl)
spl <- slitFrame(PTclim05,'year')
str(spl)

summarize a modelFrame object

Description

A summary of a modelFrame object is obtained.

Usage

## S3 method for class 'modelFrame'
summary(object, ...)

Arguments

object

an object inheriting from class modelFrame.

...

additional optional arguments passed to summary.lme method.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

Examples

##TRW chronology (mm) and inside-bark radii
data(Pchron,envir = environment())

## Parameters of allometric model to compute Diameter at Breast
## Height over bark (DBH, cm) from diameter inside bark (dib, cm)
## and Total Tree Biomass (TTB, kg tree -1 ) from DBH (Lara
## et. al. 2013):
biom_param <- c(2.87, 0.85, 0.05, 2.5)

## Modeling tree-biomass fluctuations while accounting for
## within-plot source variability (see defaults in "modelFrame"
## function):
 
 trwf <- modelFrame(Pchron,
                    to = 'cm',
                    MoreArgs = list(mp = c(2,1, biom_param)),
                    log.t = TRUE,
                    on.time = TRUE)
 summary(trwf)

ltd formulas

Description

This function formulates linear time-decline formulas (ltd) from categorical variables in multilevel ecological data series.

Usage

tdForm(rd, prim.cov = FALSE, on.time = TRUE, log.t = FALSE, lev.rm = NULL)

Arguments

rd

data.frame or character vector. Multilevel ecological data series or vector of ecological factors.

prim.cov

logical. Print a primary covariate form: '~ cov'. If FALSE then a complete formula: 'resp ~ cov | group' is printed.

on.time

logical. If TRUE then t = 'time' (see rtimes). If FALSE then t = 'year'.

log.t

logical. If TRUE then f(time) = ln(time). Default FALSE produces a log-linear time-decline formula.

lev.rm

NULL or character name of the ecological factor(s) in the MEDS to be removed from the formula.

Details

the ltd formulas belong to following general equation: log (x) = log (csx) + f(time); where the relative organic growth (x) is explained by the cumulative organic growth (csx) plus a function of time f(time); with f(time) being either the time or a logarithmic transformation the time. The ltd can be implemented by modelFrame function to subtract trends in organic MEDS

Value

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

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

References

Zeide B. 1993. Analysis of Growth Equations. For. Sci., 39: 594-616.

Examples

## an ltd formula:
lev <- c('plot','tree')
tdeq <- tdForm(lev,log.t = TRUE)
tdeq
## (not run) only primary covariate:
tdeq1 <- tdForm(lev,prim.cov = TRUE)
tdeq1
##Multilevel data frame of tree-ring widths:
data(Prings05,envir = environment())
## removing two levels: 'plot' and 'tree' from the formula
tdea2 <- tdForm(Prings05, lev.rm = c('plot','tree'))
tdea2 <- tdForm(Prings05, lev.rm = 2:3)

Average temperatures

Description

Monthly average temperatures (degree C).

Usage

data(Temp)

Format

data.frame object with 24 records.

Column

Column names contain plot codes and monthly abbreviations

Details

Recorded months begin at January and end at December, and observed years span from 1951 to 2005. Factor in data set defines one sample level (plot)

References

Bogino, S., and Bravo, F. (2008). Growth response of Pinus pinaster Ait. to climatic variables in central Spanish forests. Ann. For. Sci. 65, 1-13.

Examples

str(Temp)

Walter-Lieth aridity index

Description

Computing the annual aridity index from Walter-Lieth climate diagrams

Usage

wlai(cd, sqt = TRUE)

Arguments

cd

data.frame. Multilevel climatic data series of monthly precipitation sums (mm), and monthly average temperatures (degree C), with row names being monthly characters in month.abb or month.name.

sqt

logical. Print the square root of the aridity index. If TRUE then computed aridity index is normalized with a square root transformation.

Details

Areas between temperature and precipitation lines when precipitation exceeds temperature are calculated as indicators of moist seasons, and areas where temperature exceeds precipitation are calculated as indicator of dry season. The aridity index is defined as the quotient between the areas of dry and wet seasons. Precipitations over 100 mm are scaled such that 1 degree C is equal to 5 mm.

Value

numeric aridity index and plot of the Walter-Lieth diagram.

Author(s)

Wilson Lara <[email protected]>, Felipe Bravo <[email protected]>

References

Manrique E., A. Fernandez-Cancio. 2000. Extreme climatic events in dendroclimatic reconstructions from Spain. Clim. Chang., 44: 123-138.

Examples

##random simulation of climatic records
set.seed(1)
pr <- rnorm(12,1,1)
tm <- rnorm(12,0,1)
cld <- data.frame(pr,tm)
##labels of months from october to september
rownames(cld) <- month.abb[c(10:12,1:9)]
rownames(cld) <- c(10:12,1:9)
##computation of the aridity index and climate diagram
AI <- wlai(cld)
AI