Type: | Package |
Title: | Multilevel Modeling of Dendroclimatical Fluctuations |
Version: | 0.9.1 |
Date: | 2025-04-03 |
Maintainer: | Wilson Lara <wilarhen@gmail.com> |
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 |
Repository: | CRAN |
Date/Publication: | 2025-04-03 17:50:07 UTC |
Packaged: | 2025-04-03 17:30:33 UTC; wihe |
Author: | Wilson Lara |
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.1 |
Date: | 2025-04-03 |
Authors@R: | c(person(given = "Wilson", family = "Lara", role = c("aut", "cre"), email = "wilarhen@gmail.com", comment = c(ORCID = "0000-0003-3527-1380")), person(given = "Felipe", family = "Bravo", role = "aut", email = "fbravo@pvs.uva.es", comment = c(ORCID = "0000-0001-7348-6695"))) |
Maintainer: | Wilson Lara <wilarhen@gmail.com> |
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 |
Repository: | CRAN |
Date/Publication: | 2022-05-02 19:52:02 UTC |
Author: | Wilson Lara [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo [aut] (<https://orcid.org/0000-0001-7348-6695>) |
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 <wilarhen@gmail.com>
Author(s)
Wilson Lara <wilarhen@gmail.com>, Felipe Bravo <fbravo@pvs.uva.es>
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)
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)
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)
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)
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 |
|
mp |
|
fun |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
... |
other optional fitted model objects inheriting from
classes "modelFrame", "lme", "lm", among other (see
|
test |
optional character string specifying the |
type |
optional character string specifying the |
adjustSigma |
If TRUE and the estimation method used to obtain
|
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 |
L |
optional numeric vector or array specifying linear
combinations of the coefficients in the model that should be
tested to be zero (see |
verbose |
optional logical value. If TRUE, the calling
sequences for each fitted model |
Value
data frame inheriting from class "anova.lme".
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
## \donttest{
## 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:
## \donttest{
## trwfl <- lm(log(x) ~ log(csx) + year,
## data = trwf$'model'$'data')
## }
## Comparing model likelihoods with anova method:
## \donttest{
## 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 |
|
fun |
|
... |
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
cl |
|
Value
character
names.
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
form |
|
res.data |
|
... |
Further arguments to be passed to |
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
## \donttest{
## 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):
## \donttest{
## pdata <- trwf$'model'$'data'
## rlme <- frametoLme(pdata,
## form = 'tdForm',
## method = 'ML',
## log.t = TRUE)
## summary(rlme$model)
## }
##a plot of the modeled fluctuations:
## \donttest{
## d <- nlme::groupedData(lmeForm(rlme$fluc,lev.rm = 1),data = rlme$fluc)
## plot(d,groups = ~ sample,auto.key = TRUE)
## }
## A model of aridity:
## \donttest{
## cf <- modelFrame(PTclim05,
## lv = list('year','year'),
## fn = list('moveYr','wlai'),
## form = NULL)
## summary(cf)
## }
## An lme model of aridity at 'plot' level:
## \donttest{
## cdata <- cf$'model'$'data'
## rmod <- frametoLme(cdata,form = 'lmeForm')
## summary(rmod$model)
## rk <- nlme::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 |
|
levels |
|
Value
numeric vector with expanded/reduced levels
.
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
prim.cov |
|
resp |
|
covar |
|
lev.rm |
|
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> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
Metric system
Description
This function control metric units.
Usage
mUnits(x, from = "mm",
to = "mm")
Arguments
x |
|
from |
|
to |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
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 |
|
fn |
|
lv |
|
form |
|
... |
Further arguments in |
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
## \donttest{
## 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:
## \donttest{
## 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 |
|
ini.mnt |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
cd |
|
rd.var |
|
cd.var |
|
... |
Further arguments in |
Details
Function mgram
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
## /donttest{
## 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:
## /donttest{
## aif <- modelFrame(rd = list(Prec, Temp),
## fn = list('moveYr','wlai'),
## lv = list('year','year'),
## form = 'lmeForm')
## }
##Multivariate comparison:
## /donttest{
## mcomp <- muleMan(trwf,
## aif,
## nperm = 10^3)
## str(mcomp)
## }
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 |
... |
further arguments passed to the Trellis plot function. |
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
## /donttest{
## 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 |
... |
further arguments passed to the Trellis plot function. |
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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):
## \donttest{
## 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:
## \donttest{
## aif <- modelFrame(rd = list(Prec, Temp),
## fn = list('moveYr','wlai'),
## lv = list('year','year'),
## form = 'lmeForm')
## }
##Multivariate comparison:
## \donttest{
## 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 |
|
... |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
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 |
|
lv |
|
fn |
|
... |
Further arguments in the function being specified
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
only.dup |
|
Value
data.frame
object with the initial vector and its time
units.
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
sc.c |
|
rf.t |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
|
f.nm |
|
x.nm |
|
t.nm |
|
... |
Further arguments in |
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
Examples
##tree-ring widths formated as a \code{\link[nlme]{groupedData}} object:
data(Prings05,envir = environment())
## Formatting the \code{\link[nlme]{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 |
|
lv |
|
Value
list
of data.frame
objects.
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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 |
... |
additional optional arguments passed to
|
Author(s)
Wilson Lara <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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):
## \donttest{
## 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 |
|
prim.cov |
|
on.time |
|
log.t |
|
lev.rm |
NULL or |
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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)
Walter-Lieth aridity index
Description
Computing the annual aridity index from Walter-Lieth climate diagrams
Usage
wlai(cd, sqt = TRUE)
Arguments
cd |
|
sqt |
|
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 <wilarhen@gmail.com> [aut, cre] (<https://orcid.org/0000-0003-3527-1380>), Felipe Bravo <fbravo@pvs.uva.es> [aut] (<https://orcid.org/0000-0001-7348-6695>)
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