Learn R Programming

mvmeta (version 1.0.3)

na.omit.data.frame.mvmeta: Handling Missing Values in mvmeta Models

Description

These method functions exclude rows corresponding to studies with invalid missing pattern from model frames of class "data.frame.mvmeta". This guarantees the correct handling of missing values while fitting multivariate and univariate meta-analytical models.

Usage

# S3 method for data.frame.mvmeta
na.omit(object, …)

# S3 method for data.frame.mvmeta na.exclude(object, …)

Arguments

object

an object of class "data.frame.mvmeta".

further arguments passed to or from other methods.

Value

These functions returns the model frame object with rows corresponding to studies with invalid missing pattern being removed. They also add the related na.action attribute as explained above.

Details

A model frame of class "data.frame.mvmeta" is produced by mvmeta. A call to na.omit or na.exclude removes from the model frame the rows corresponding to studies with invalid missing pattern. In addition, a na.action attribute is added to the model frame, namely a numeric vector corresponding to the removed rows and class "omit" or "exclude", respectively. This information is used by naresid and napredict to deal with missing values in functions such as fitted, residuals, predict and blup, among others.

The definition of missing, identifying an invalid missing pattern, is different in multivariate meta-analytical models performed through mvmeta if compared to other regression functions such as lm or glm. Specifically, while a study is removed if at least an observation for one predictor is missing, partially missing outcomes do not prevent the study to contribute to estimation (see mvmeta). Specific methods na.omit and na.exclude for class "data.frame.mvmeta" allow this different definition.

See Also

See na.action, naresid and napredict. See model.frame. See mvmeta-package for an overview of the package and modelling framework.

Examples

Run this code
# NOT RUN {
# INPUT MISSING VALUES IN PREDICTOR AND ONE RESPONSE
data <- berkey98
data[2,1] <- data[4,3] <- NA
data

# RUN THE MODEL
model <- mvmeta(cbind(PD,AL)~pubyear,S=data[5:7],data=data,method="ml")

# SUMMARIZE: NOTE THE NUMBER OF STUDIES AND OBSERVATIONS
summary(model)
df.residual(model)

# EXTRACT THE MODEL FRAME WITH na.pass
model.frame(model,na.action="na.pass")
# EXTRACT THE MODEL FRAME WITH na.omit (DEFAULT)
model.frame(model,na.action="na.omit")

# COMPARE WITH DEFAULT METHOD FOR na.omit
frame <- model.frame(model,na.action="na.pass")
na.omit(frame)
class(frame)
class(frame) <- "data.frame"
na.omit(frame)

# WITH na.exclude
residuals(model)
residuals(update(model,na.action="na.exclude"))
# }

Run the code above in your browser using DataLab