sim_Bai: Simulate Spline Data

View source: R/sim_bai.R

sim_BaiR Documentation

Simulate Spline Data

Description

Simulation functions for binomial, gaussian and poisson outcomes. The simulation equations follow Bai

Usage

sim_Bai(n, p, family = binomial(), dispersion = 1)

Arguments

n

Integer, sample size

p

Integer, number of predictors. The minimum number of predictors is default to 4. If user input p<4, p changes to 4 with a warning message

family

Family object, one of binomial (default), gaussian , poisson. Please see family for more detail

dispersion

Double, required for gaussian distribution, match to sd parameter.

Details

[Experimental]

Value

a list contains dat, eta, mu

  • dat a numeric matrix, contains predictors x1 to xp where p is replaced by the integer value. The outcome variable is named y

  • etathe linear predictor of the simulated data

  • muthe mean of the simulated data

Examples

# Binomial Outcome
sim_Bai(100, 4)

# Logistic Outcome
sim_Bai(100, 4, family = poisson())

# Gaussian Outcome with measurement error variance = 1
sim_Bai(100, 4, family = gaussian(), dispersion = 1 )

boyiguo1/BHAM documentation built on Jan. 29, 2024, 10:37 a.m.