Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/generate_JointModelEq.R
This function generates a matrix of 0 with rows corresponding to the names of variables included in the dataset and column corresponding to selection and outcome equations for each MNAR outcome. The user has to fill this matrix with 1 for variable included in selection and/or outcome equations of MNAR outcome imputation models.
1 | generate_JointModelEq(varMNAR, data)
|
varMNAR |
The name of MNAR outcome to be imputed. |
data |
The dataset used for classical multiple imputation by chained equation and additional variables necessary for MNAR imputation models. |
Be careful to not define the same selection and outcome equations for MNAR imputation models. A constraint of the sample selection model implies the inclusion of different sets of covariates, which may or not be nested in the selection equation and the outcome equation, to avoid collinearity issues. It has been recommended to include at least a supplementary variable in the selection equation. This variable should be known to be unlinked directly to the outcome.
A matrix such as:
Rows correspond to names of variables included in the data
argument
Columns correspond to selection and outcome equations for each MNAR outcome imputation models
Each column is named as "MNAR outcome" names adding "_var_sel" or "_var_out" corresponding to variables included in selection and outcome equation respectively.
Jacques-Emmanuel Galimard
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Import dataset with a suspected MNAR mechanism
require(GJRM)
data("hiv")
# We select only one region (lusuka) and 5 variables
lusuka <- hiv[hiv$region==5,c("hiv", "age", "marital", "condom", "smoke")]
# Categorical variables have to be recoded as factor
lusuka$hiv <- as.factor(lusuka$hiv)
# Specify a selection (missing data mechanism) and an outcome equation (analyse model)
# Generate an empty matrix
JointModelEq <- generate_JointModelEq(data=lusuka,varMNAR = "hiv")
# Fill in with 1 for variable included in equations
JointModelEq[,"hiv_var_sel"] <- c(0,1,1,1,1)
# This indicates that age, marital, condom and smoke are included in the selection equation of hiv
JointModelEq[,"hiv_var_out"] <- c(0,1,1,1,0)
# This indicates that age, marital and condom are included in the outcome equation of hiv
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.