Description Usage Arguments Details Value References See Also Examples
Performs EMD-R2 by using the given regression function in each MIMF.
1 2 3 4 5 6 7 8 9 10 |
formula |
A formula describing the models to be fit for each MIMF. |
mimf |
|
covariates |
A list or data.frame containing eventual covariates which are not IMFs. |
tt |
A vector of time indices for |
reg.fun |
The regression function to perform either as a function or
as a character. Should include |
reg.args |
A list containing additional arguments to be passed to
|
pimf.args |
A list of arguments to be passed to the function
|
xy.args |
A character vector of length two indicating the argument
names corresponding to the predictors and response in the case
|
emdr2
wraps the chosen regression function (reg.fun
),
and applies it once per MIMF in mimf
. Variables given in
covariates
are used with each IMF.
reg.fun
can include either a couple formula
and data
arguments, either x
and y
arguments. Particular
argument names for the response or predictor variables can be given
in xy.args
.
A emdr2
object which is a list of length nimf containing all
results of reg.fun
on individual MIMFs.
Masselot, P., Chebana, F., Belanger, D., St-Hilaire, A., Abdous, B., Gosselin, P., Ouarda, T.B.M.J., 2018. EMD-regression for modelling multi-scale relationships, and application to weather-related cardiovascular mortality. Science of The Total Environment 612, 1018-1029.
extract.emdr2
to extract a particular element of the
result from reg.fun
for each submodel. coef.emdr2
to specifically extract the coefficients. predict.emdr2
to obtain predictions from the whole EMD-R2 model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
library(dlnm)
library(glmnet)
dat <- chicagoNMMAPS[,c("death", "temp", "rhum")]
mimfs <- memd(dat)
cmimfs <- combine.mimf(mimfs, list(12:13, 14:17, 18:19),
new.names = c("C12", "C13", "r"))
amps <- mean_amplitude(cmimfs)
# EMD-R2 with glm
lm.R2 <- emdr2(death ~ temp + rhum, mimf = cmimfs)
betas.R2 <- coef(lm.R2)
sensitivity.R2 <- sensitivity(amps[,-1], coefs = betas.R2[,-1])
plot_emdr(sensitivity.R2, periods = period(cmimfs)[,-1],
col = c("red", "blue"), pch = 16:17)
abline(h = 0, lty = 2)
# EMD-R2 with lasso
lasso.R2 <- emdr2(death ~ temp + rhum, mimf = cmimfs,
reg.fun = "cv.glmnet")
betas.R2 <- coef(lasso.R2, s = "lambda.1se")
sensitivity.R2 <- sensitivity(amps[,-1], coefs = betas.R2[,-1])
plot_emdr(sensitivity.R2, periods = period(cmimfs)[,-1],
show.coef = "nonzero", pch = 16:17)
abline(h = 0, lty = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.