predict.rendo.multilevel: Predict method for Multilevel GMM Estimations

Description Usage Arguments Value See Also Examples

View source: R/f_s3_multilevel.R

Description

Predicted values based on multilevel models employing the GMM approach for hierarchical data with endogenous regressors.

Usage

1
2
3
4
5
6
7
## S3 method for class 'rendo.multilevel'
predict(
  object,
  newdata,
  model = c("REF", "FE_L2", "FE_L3", "GMM_L2", "GMM_L3"),
  ...
)

Arguments

object

Object of class inheriting from "rendo.multilevel"

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values for the specified model are returned.

model

character string to indicate for which fitted model predictions are made. Possible values are: "REF", "FE_L2", "FE_L3", "GMM_L2", or "GMM_L3".

...

ignored, for consistency with the generic function.

Value

predict.rendo.multilevel produces a vector of predictions

See Also

The model fitting function multilevelIV

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data("dataMultilevelIV")

# Two levels
res.ml.L2 <- multilevelIV(y ~ X11 + X12 + X13 + X14 + X15 + X21 + X22 + X23 + X24 + X31 +
                          X32 + X33 + (1|SID) | endo(X15),
                          data = dataMultilevelIV, verbose = FALSE)
predict(res.ml.L2, model = "FE_L2")

# using the data used for fitting also for predicting,
#    correctly results in fitted values
all.equal(predict(res.ml.L2, dataMultilevelIV, model = "GMM_L2"),
          fitted(res.ml.L2, model = "GMM_L2")) # TRUE

REndo documentation built on Sept. 5, 2021, 5:37 p.m.