simulateMissDfYorX {glmfitmiss}R Documentation

Simulate missing covariate or missing responses data based on an input covariate data

Description

This function generates missing covariate or missing responses data. The missing data generation in the last two supplied covariates will be generated based on a predefined mechanisms. Missing data generation in the response variable will be based on the suppilied true alpha.

Usage

simulateMissDfYorX(
  dataCov,
  truebeta = c(1, -1, 1, 5),
  truealpha = c(-1, 5, -1, -1, -1, 0.01),
  x2Mar = c(1, -1, -1),
  ymiss = FALSE,
  nsim = 1
)

Arguments

dataCov

input data, the default number of covariates is 7 (5+2)

truebeta

the beta parameter to be used to generate binary responses 1/0 s logit(y=1)=x1+x2+x3

truealpha

to be used to generate nonignorable missing values based on the model logit(R=1)=y+x1+x2+x3+x4+..

x2Mar

to be used to generate missing values in x2 based on the model logit(x2=missing)=x1+y

ymiss

to be used for missing responses, default is FALSE

nsim

number of simulated dataset, default is 2

Value

returns a list with original data called originalData and a data with imputed missing values dataMissing

Examples

demo_df <- simulateCovariateData(100, nCov=6)
simulated_df <- simulateMissDfYorX(demo_df, nsim=2)
testMissData <- simulated_df$dataMissing
head(testMissData)


[Package glmfitmiss version 2.1.0 Index]