f_four: Function of x on a fourier basis

View source: R/simData.R

f_fourR Documentation

Function of x on a fourier basis

Description

Function of x on a fourier basis with a subset of covariates having a causal effect on Y using the parameters beta. The function is given by:

f(x_i) = \sum_{j = 1}^p 1_{j \in js} \sum_{k = 1}^K (\beta_{j, k}^{(1)} \cos(0.2 k x_j) + \beta_{j, k}^{(2)} \sin(0.2 k x_j))

Usage

f_four(x, beta, js)

Arguments

x

a vector of covariates

beta

the parameter vector for the function f(X)

js

the indices of the causal covariates in X

Value

the value of the function f(x)

Author(s)

Markus Ulmer

See Also

simulate_data_nonlinear

Examples

set.seed(42)
# simulation of confounded data
sim_data <- simulate_data_nonlinear(q = 2, p = 150, n = 100, m = 2)
X <- sim_data$X
j <- sim_data$j[1]
apply(X, 1, function(x) f_four(x, sim_data$beta, j))


SDModels documentation built on April 11, 2025, 5:50 p.m.