simBKMRDLM: Simulate data for BKMR-DLM.

View source: R/simBKMRDLM.R

simBKMRDLMR Documentation

Simulate data for BKMR-DLM.

Description

Simulate data for BKMR-DLM.

Usage

simBKMRDLM(n = 200, scenario = "A", sd = 1, seed, dta)

Arguments

n

Number of observations.

scenario

Simulation scenario (A, B, C, D, E, F).

sd

Error standard deviation.

seed

An optional seed.

dta

A list with data to use. The elements should be X, a list of exposure matrices, and Z a matrix of covariates. If not data is provided then data will be simulated automatically.

Value

A list containing simulated data

Examples

 
library(regimes)
#simulate data from scenario A
dat <- simBKMRDLM(n = 200, scenario="A", sd=1, seed=1234)
# Estimate model
# This may take a few minutes
# Increase iterations for a real analysis
fit <- bkmrdlm(y=dat$y,
               x=dat$x,
               z=dat$z,
               niter=100,
               gaussian=FALSE,
               polydegree=2)
               
summary(fit)
plot(fit)

AnderWilson/regimes documentation built on Aug. 5, 2023, 8:30 a.m.