simulated_dataset: Simulated Dataset Generator

Description Usage Arguments Details Value Examples

View source: R/simulated_dataset.R

Description

Generate a simulated dataset, which could be used to demonstrate the features of the mpersonalized package.

Usage

1
simulated_dataset(n, problem = c("meta-analysis", "multiple outcomes"))

Arguments

n

Sample size for each study/outcome.

problem

A character string specified what problem the simulated dataset is generated for. problem can be set to "meta-analysis" or "multiple outcomes".

Details

In the simulated dataset, outcomes are generated from the model

Y = δ_0 + \bm{X} \bm{δ} + A (θ_0 + \bm{X}\bm{θ})+ε,

where \bm{X} is the baseline covariates and A is the treatment indicator coded as 0,1. For different outcomes or studies, values of δ_0, \bm{δ}, θ_0 and \bm{θ} are also different so as to represent the heterogeneity in real problems.

The number of different studies/outcomes is set to be 6 and total number of candidate covariates is 50. Treatment indicator A is generated with equal probability of 0 or 1.

This function randomly generates the coefficients for each study/outcome and then generates the baseline covariates and error term for each subject. Depending on the value of problem, generation of baseline covariates are slightly different. For problem = "meta-analysis", baseline covariates are generated independently for each study; for problem = "multiple outcomes", baseline covariates are the same across different outcomes.

Value

A list object of the ingredients from the simulated dataset. The elements of this list depends on value of problem.

For problem = "meta-analysis",

Xlist

a list object with kth element denoting the baseline covariate matrix of kth study

Ylist

a list object with kth element denoting the response vector of kth study

Trtlist

a list object with kth element denoting the treatment vector of kth study and coded as 0 or 1

B

the coefficient matrix containing δ_0, \bm{δ}, θ_0 and \bm{θ}

For problem = "multiple outcomes",

X

a matrix object denoting the baseline covariate matrix

Ylist

a list object with kth element denoting the response vector of kth outcome

Trt

a vector denoting the treatment and coded as 0 or 1)

B

the coefficient matrix containing δ_0, \bm{δ}, θ_0 and \bm{θ}

Examples

1
2
3
4
5
6
set.seed(123)
sim_dat  = simulated_dataset(n = 200, problem = "meta-analysis")
str(sim_dat$Xlist)
str(sim_dat$Ylist)
str(sim_dat$Trtlist)
set.seed(NULL)

chenshengkuang/MetaPersonalized documentation built on May 28, 2019, 7:16 p.m.