simulate_functions: Simulate example functional data

View source: R/simulate_functions.R

simulate_functionsR Documentation

Simulate example functional data

Description

Function for simulating a set of functional data based on a deterministic function with covariates that affect the shape of the functions

Usage

simulate_functions(M, N, seed)

Arguments

M

Number of functions

N

Number of samples per function

seed

Seed for reproducibility

Details

The functions are generated using the following equation:

f(t) = (x_1*exp(-((t-0.3)^2)/0.005)) + (x_2(-((t-(0.7+x_3))^2/0.005)))

where the covariates are generated as follows:

  • x_1 generated from Unif(0.1,1)

  • x_2 generated from Unif(0.1,0.5)

  • x_3 generated from Unif(-0.1,0.1)

Value

Data frame with the following columns (where f is the function):

  • t: "time" associated with sample from function where t in [0,1]

  • y: f(t) for the particular observation

  • x1: covariate 1 for function $f$ (constant across time)

  • x2: covariate 2 for function $f$ (constant across time)

  • x3: covariate 3 for function $f$ (constant across time)

Examples

# Simulate data
sim_data = simulate_functions(M = 100, N = 75, seed = 20211130)

veesa documentation built on April 3, 2025, 6:03 p.m.