bandSelect: Penalized multi-band learning function

Description Usage Arguments Value References See Also Examples

View source: R/bandSelect.R

Description

In a group of individuals with physcial activity data, this function utilize Fast Fourier Transform (FFT) and L-1/L-2 penalties to select significant harmonics/periodicities and describe the main activity pattern (circadian rhythm) among the population.

Usage

1
2
bandSelect(df, Nlength, Nlambda = 100, alpha = 1, Ntop = 5,
  cross = FALSE, Ncross = NULL, plot = TRUE)

Arguments

df

the tbl_df data frame containing at least two variables: subject ID and activity. The function form can help prepare the data frame.

Nlength

the length of observations necessary for each individual, note that it should be consistent among all

Nlambda

λ's take values from 0 to 2max(||X_k||^2), as 0 gives no penalty and the latter suppresses all θ's to 0. Therefore, we divide 2max(||X_k||^2) into Nlambda (default to be 100) λ's to pick frequencies/harmonics/periodicities.

alpha

the tuning parameter controlling the balance between L-1 and L-2 penalty. The default is 1, using complete Lasso/ L-1 penalty.

Ntop

the number of frequencies/harmonics/periodicities picked for the population. The default is 5.

cross

whether to perform cross-validation. The default is FALSE.

Ncross

the number of groups of data for cross-validation. If cross=TRUE, the data shall be divided into Ncross groups.

plot

whether to plot: MSE against the number of nonzero θ's, and only the points at which the number of nonzero θ's changes (as λ changes) are be plotted. The default is TRUE.

Value

if no cross-validation is conducted, return a list; if cross-validation, return a list of lists, with the last list consisting of all FFT results and cross-validation groups (showing the subject IDs leave-out /NOT used each time).

topfreq

vector of length Ntop: top frequencies selected.

mse

vector of length Nlambda: mean squared error for each lambda (penalty). If no cross-validation, mse is calculated based on all available data; if cross-validation, mse is calculated based on the rest observations.

nonzero

vector of length Nlambda: the number of nonzero θ's (frequencies) for each lambda (penalty).

deltazero

vector of length Nlambda: the change in the number of nonzero θ's (frequencies) for each lambda (penalty).

lambda

vector of length Nlambda: the value of lambda.

theta

Nfreq by Nlambda matrix: estimated θ's (frequencies) at each lambda (penalty). Nfreq is the total number of frequencies given by FFT.

xscore

Nind by Nfreq matrix: the original FFT scores for each individual. Nind is the number of individuals in the population, and Nfreq is the total number of frequencies given by FFT.

xprop

Nind by Nfreq matrix: the original FFT results expressed as the proportion of variances explained by each frequency for each individual. Nind is the number of individuals in the population, and Nfreq is the total number of frequencies given by FFT.

freq

vector of length Nfreq: list of frequencies in FFT results.

References

Li, X. , Kane, M. , Zhang, Y. , Sun, W. , Song, Y. , Dong, S. , Lin, Q. , Zhu, Q. , Jiang, F. & Zhao, H. (2019). Penalized Selection of Periodicities Characterizes the Consolidation of Sleep-Wake Circadian Rhythms During Early Childhood Development. Submitted.

See Also

form

Examples

1
2
3
data(pa3)
re <- bandSelect(df=pa3,Nlength=1440*3,Nlambda=100,alpha=1,Ntop=5,
                 cross=FALSE,Ncross=NULL,plot=TRUE)

PML documentation built on Feb. 12, 2020, 1:17 a.m.