simulate_functional_data: Simulate functional data

View source: R/simulate_functional_data.R

simulate_functional_dataR Documentation

Simulate functional data

Description

This function simulates functional data. The data it outputs is generated from a mean function and two orthogonal principal component basis functions. The mean and principal components are based on sine and cosine functions. Subject-specific scores for each PC are drawn from normal distributions with standard deviation lambda1 and lambda2.

Usage

simulate_functional_data(
  lambda1 = 2,
  lambda2 = 1,
  I = 50,
  D = 100,
  seed = 1988,
  vary_D = FALSE
)

Arguments

lambda1

Standard deviation for PC1 scores.

lambda2

Standard deviation for PC2 scores.

I

Number of subjects. Defaults is 50.

D

Number of grid points per subject. Default is 100.

seed

Seed for reproducibility. Default is 1988.

vary_D

Indicates if grid length vary by subject. If FALSE all subjects have grid length D.

Value

A list containing:

Y

Simulated dataframe with variables id, value, index, and latent_mean.

psi1

True values for first principal component.

psi2

True values for second principal component.

alpha

True values for population-level mean.

A list containing:

Y

A dataframe of simulated data.

psi1

The first simulated eigenfunction.

psi2

The second simulated eigenfunction.

alpha

The population mean.

Author(s)

Julia Wrobel julia.wrobel@cuanschutz.edu


registr documentation built on Oct. 3, 2022, 1:05 a.m.