dlm {treeclim} | R Documentation |
Dendro-flavoured linear model
Description
This is a wrapper around lm
for working with the
same data structures and modifiers as dcc
does.
Usage
dlm(
chrono,
climate,
selection,
timespan = NULL,
var_names = NULL,
param_names = NULL,
intercept = TRUE,
scale = FALSE,
verbose = TRUE
)
Arguments
chrono |
|
climate |
either a |
selection |
either a numeric vector, a modifier, or a chain of modifiers specifying the parameter selection for the model (see Details). |
timespan |
|
var_names |
|
param_names |
|
intercept |
|
scale |
|
verbose |
|
Details
Input chronology data can be a data.frame
such as produced
by function chron
of package dplR. It has to be a
data.frame
with at least one column containing the
tree-ring indices, and the corresponding years as rownames
.
For climatic input data, there are three possibilities: Firstly,
input climatic data can be a data.frame
or matrix
consisting of at least 3 rows for years, months and at least one
climate parameter in the given order. Secondly, input climatic
data can be a single data.frame
or matrix
in the
style of the original DENDROCLIM2002 input data, i.e. one
parameter with 12 months in one row, where the first column
represents the year. Or thirdly, input climatic data can be a
(potentially named) list of one or several of the latter described
data.frame
or matrices
. If named list is provided,
potentially provided variable names through argument
var_names
are ignored. As an internal format dispatcher
checks the format automatically, it is absolutely necessary that
in all three cases, only complete years (months 1-12) are
provided. It is not possible to mix different formats in one go.
In 'dlm', there is no default parameter selection, in contrast to 'dcc'. Parameters can be selected with the 'selection' parameter in two different ways:
simple selections: as an example -6:9 selects from all climate variables all months from previous year's June (-6, previous year's months are specified as negative integers) to current years September (9, months of the current year are specified as positive integers) as model parameters. Months from the previous year and the year before that can be selected using treeclim-shifters like
..(6)
to refer to July of the year before the previous year.using modifiers: More complex parameter selections can be obtained by the modifiers provided in treeclim:
.range
,.mean
, and.sum
. These modifiers can also be chained to create complex selections. See treeclim-modifiers for details.
For the exclusion of months, the convenience function
exclude_from
(or short exfr
) is
provided.
With 'dlm' one would usually try to keep the number of predictors low.
For pretty output of the resulting linear model, parameters can be renamed, to e.g. reflect the season they represent.
Value
'dlm' returns an 'object' of class '"tc_dlm"', which is a superclass of 'lm'. Additional elements to what is included in standard 'lm' objects:
call_dlm |
the call made to function 'dlm' |
design |
the design matrix on which this call to 'dlm' operates |
truncated |
the input data truncated to the common timespan or the specified timespan |
original |
the original input data, with the climate data being recast into a single data.frame |
Author(s)
Christian Zang
Examples
dlm1 <- dlm(rt_spruce, rt_prec, .sum(6:8), param_names = "summer_prec")
summary(dlm1)
dlm2 <- dlm(rt_spruce, list(rt_prec, rt_temp),
.sum(6:8, "prec") + .mean(6:8, "temp"), var_names = c("prec", "temp"),
param_names = c("summer_prec", "summer_temp"))
summary(dlm2)
anova(dlm1, dlm2)