miss.lm: Statistical Inference for Linear Regression Models with...

Description Usage Arguments Value Examples

Description

This function is used to perform statistical inference for linear regression model with missing values, by algorithm EM.

Usage

1
miss.lm(formula, data, control = list(...), ...)

Arguments

formula

an object of class "formula" : a symbolic description of the linear regression model to be fitted.

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which miss.lm is called.

control

a list of parameters for controlling the fitting process. For miss.lm.fit this is passed to miss.lm.control.

...

arguments to be used to form the default control argument if it is not supplied directly.

Value

An object of class "miss.lm": a list with following components:

coefficients

Estimated β.

ll

Observed log-likelihood.

s.resid

Estimated standard error for residuals.

s.err

Standard error for estimated parameters.

mu.X

Estimated μ.

Sig.X

Estimated Σ.

call

the matched call.

formula

the formula supplied.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Generate complete data
set.seed(1)
mu.X <- c(1, 1)
Sigma.X <- matrix(c(1, 1, 1, 4), nrow = 2)
n <- 50
p <- 2
X.complete <- matrix(rnorm(n*p), nrow=n)%*%chol(Sigma.X) +
              matrix(rep(mu.X,n), nrow=n, byrow = TRUE)
b <- c(2, 3, -1)
sigma.eps <- 0.25
y <- cbind(rep(1, n), X.complete) %*% b + rnorm(n, 0, sigma.eps)

# Add missing values
p.miss <- 0.10
patterns <- runif(n*p)<p.miss #missing completely at random
X.obs <- X.complete
X.obs[patterns] <- NA

# Estimate regression using EM
df.obs = data.frame(y,X.obs)
miss.list = miss.lm(y~., data=df.obs)
print(miss.list)
print(summary(miss.list))
summary(miss.list)$coef

misaem documentation built on April 12, 2021, 9:06 a.m.