createcorlag: Transform dataframe by creating multiple lagged variables...

Description Usage Arguments Value Author(s)

Description

Given a dataframe containing a target and covariates, createcorlag returns a dataframe containing all the variables and only the lagged variables whose absolute pairwise correlation with the target exceeds a fixed threshold. Lag function is applied by groups. Additional variables that should not be lagged can be provided.

Usage

1
2
createcorlag(df, refvar="incidence", groupingvar = c("sex","age","Country_Transco"), k = 1, cross_cor_threshold=0.2,
                      labelvar = c("year", "Zonier"))

Arguments

df

Dataframe whose variables must be lagged

refvar

Reference variable or target from which to compute the cross correlation with other lagged variables

cross_cor_threshold

Correlation threshold required to keep a lag

groupingvar

Variables used to define group

k

Maximum lag that must be computed. If k>1, lags 1:k are computed

labelvar

Variables that should not be lagged

Value

A dataframe with non lagged and lagged observations -whose absolute correlation with the target exceeds the selected threshold- by groups.

Author(s)

Benjamin Schannes


EpidemiumOpenCancer/OpenCancer documentation built on May 12, 2019, 7:46 a.m.