mi.logcontinuous {mi}R Documentation

Elementary function: linear regression to impute a continuous positive variable.

Description

Imputes univariate missing data using linear regression on the logarithm values.

Usage

  mi.logcontinuous( formula, data = NULL, start = NULL, n.iter = 100, draw.from.beta = FALSE, ... )
  ## S3 method for class 'mi.logcontinuous':
  residuals(object, y, ...)
  ## S3 method for class 'mi.logcontinuous':
  plot( x, y, main=deparse( substitute( y ) ), gray.scale = FALSE, ...)

Arguments

formula an object of class '"formula"' (or one that can be coerced to that class): a symbolic description of the model to be fitted. See bayesglm 'formula' for details.
data A data frame containing the incomplete data and the matrix of the complete predictors.
start Starting value for bayesglm.
n.iter Maximum number of iteration for bayesglm. The default is 100.
draw.from.beta Draws from posterior distribution of the betas to add randomness.
... Currently not used.
object mi.logcontinuous object.
x mi.logcontinuous object.
y Observed values.
main main title of the plot.
gray.scale When set to TRUE, makes the plot into gray scale with predefined color and line type.

Details

see lm.

Value

model A summary of the fitted model
expected The expected values estimated by the model
random Vector of length n.mis of random predicted values predicted by using the normal distribution

Note

The incomplete data vector has to be positive.

Author(s)

Masanao Yajima yajima@stat.columbia.edu, M.Grazia Pittau grazia@stat.columbia.edu, Andrew Gelman gelman@stat.columbia.edu

References

Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2007.

See Also

mi.info, mi.method, mi

Examples

  # true data
  x<-rnorm(100,0,1) # N(0,1)
  y<-rnorm(100,(4+2*x),1.2) # y ~ 1 + 2*x + N(0,1.2)
  # create artificial missingness on y
  y[seq(1,100,10)]<-NA
  dat.xy <- data.frame(x,y)
  # imputation
  mi.logcontinuous(y~x, data = dat.xy)

[Package mi version 0.02-02 Index]