Learn R Programming

bife (version 0.5)

predict.bife: Computes Predicted Probabilities

Description

Returns the predicted probabilities of an object returned by bife.

Usage

# S3 method for bife
predict(object, X_new = NULL, alpha_new = NULL,
  corrected = TRUE, ...)

Arguments

object

an object of class bife.

X_new

a regressor matrix for predictions. If not supplied predictions are based on the matrix returned by the object bife. See Details.

alpha_new

a scalar or vector of fixed effects. If not supplied predictions are based on the vector of fixed effects returned by bife. See Details.

corrected

an optional logical flag that specifies whether the predicted probabilities are based on the bias-corrected/-adjusted parameters. Default is TRUE (bias-corrected).

...

other arguments

Value

The function predict.bife returns a (named) vector of predicted probabilities.

Details

The regressor matrix returned by the object bife only includes individuals that were not dropped during fitting due to a non-varying response (perfect classification). The predicted probabilities of those observations are equal to their response.

If alpha_new is supplied as a scalar each predicted probability is computed with the same fixed effect. If alpha_new is supplied as a vector it has to be of same dimension as the corresponding regressor matrix.

See Also

bife

Examples

Run this code
# NOT RUN {
library("bife")

# Load 'psid' dataset
dataset <- psid
head(dataset)

# Fixed effects logit model w/o bias-correction
mod_no <- bife(LFP ~ AGE + I(INCH / 1000) + KID1 + KID2 + KID3 | ID, 
 data = dataset, bias_corr = "no")
 
# Compute predicted probabilities based on the regressor matrix
# and fixed effects stored in 'mod_no'
prob <- predict(mod_no)

# Compute predicted probabilities based on the regressor matrix
# and all fixed effects set to zero
prob_zero <- predict(mod_no, alpha_new = 0.0)

# }

Run the code above in your browser using DataLab