predict.plmm: Conditional or Unconditional Model Prediction

Description Usage Arguments Value Examples

View source: R/predict.plmm.R

Description

Predict the response values for a set of covariates based on a model fitted using a model fitting function plmm or wplmm.

Usage

1
2
3
4
## S3 method for class 'plmm'
predict(object, newdata, data, cond = TRUE, ...)
## S3 method for class 'wplmm'
predict(object, newdata, data, cond = TRUE, ...)

Arguments

object

a model fitted with plmm or wplmm.

newdata

a data frame containing sets of values of the covariates. The clustering variable may be omitted, in which case only unconditional prediction is possible. If newdata is omitted, the response of the original data set is predicted conditionally or unconditionally according to cond.

data

an optional data frame containing the variables used to fit the model. If relevant variables are not found in data, the variables are taken from the environment from which predict was called.

cond

logical. If TRUE, the response is predicted conditional on the random effect prediction for the cluster the observational unit belongs to. If FALSE, an unconditional prediction of the response, i.e. the sum of only the fixed components is computed.

...

other arguments.

Value

Predicted conditional or unconditional response values.

Examples

1
2
3
4
5
data(plmm.data)
model <- plmm(y0~x1+x2+x3|t1, random=cluster, data=plmm.data)
pred_data <- data.frame(x1=c("F","M"), x2=c(15,25), x3=c(3,2), t1=c(5, 4), cluster=c(1,5))
predict(model, newdata=pred_data, data=plmm.data)
predict(model, newdata=pred_data, data=plmm.data, cond=FALSE)

plmm documentation built on May 2, 2019, 7:29 a.m.