sensitivity: Response sensitivity to IMFs

Description Usage Arguments Details Value References See Also Examples

View source: R/emdr_results.R

Description

This function computes the sensitivity to each IMF, which is basically a regression coefficient scaled by the IMF mean amplitude.

Usage

1
sensitivity(amplitudes, model = NULL, coefs = NULL, ...)

Arguments

amplitudes

A matrix of mean amplitudes as computed by mean_amplitude. One column corresponds to a variable and one line to an IMF.

model

The result from a regression function. Must have a coef method. If not, use the argument coefs instead.

coefs

User provided coefficient matrix. Must have the same dimensions as amplitudes.

...

Additional arguments for the coef method used by model.

Details

The sensitivy term hereby designates regression coefficients scaled according to the corresponding IMF's mean amplitude. It estimates the amplitude of response's variations explained by the IMF.

The function uses the results from a regression model to compute the sensitivity. If the resulting object contains a coef method it is used to extract the necessary coefficients. If this is not the case, the coefs argument must be used instead.

Value

A matrix of sensitivities, with the same dimensions as amplitudes.

References

Masselot, P., Chebana, F., Bélanger, 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.

See Also

link{coef.emdr2} to extract coefficients from an emdr2 object.

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
   ## EMD-R1
   library(dlnm)
   library(glmnet)
   
   # Predictor decomposition
   X <- chicagoNMMAPS[,c("temp", "rhum")]
   set.seed(123)
   mimfs <- memd(X, l = 2) # Takes a couple of minutes
   cmimfs <- combine.mimf(mimfs, list(10:11, 12:13), 
     new.names = c("C10", "C11"))

   # Response variable
   Y <- chicagoNMMAPS$resp[attr(cmimfs, "tt")]

   # Data preparation: includes the day-of-week variable as potential
   # confounder
   dataR1 <- pimf(cmimfs, Y, covariates = list(dow = 
     chicagoNMMAPS$dow[attr(cmimfs, "tt")]))
   
   # Apply the Lasso
   library(glmnet)
   lasso.res <- cv.glmnet(data.matrix(dataR1[,-1]), dataR1[,1], 
     family = "poisson")

   # Compute sensitivity and plot results
   amps <- mean_amplitude(dataR1[,-1])
   betas <- coef(lasso.res)
   s <- sensitivity(amps, coefs = betas[-1]) 

   ## EMD-R2
   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"))

   # EMD-R2 with glm
   lm.R2 <- emdr2(death ~ temp + rhum, mimf = cmimfs)
   betas.R2 <- coef(lm.R2)
   amps <- mean_amplitude(cmimfs)
   sensitivity.R2 <- sensitivity(amps[,-1], coefs = betas.R2[,-1])

PierreMasselot/Library--emdr documentation built on June 19, 2021, 8:58 a.m.