Description Usage Arguments Value Examples
Function to estimate the individual fixed effects expecation-maximization estimator in Chen (2016)
1 | FEEMProbit(formula, data, tol = 1e-9, show.progress = FALSE)
|
formula |
A symbolic description of the model to be estimated. The
formula has three parts, the dependent variable, the independent variable
and the fixed effect. For example, |
data |
A |
tol |
Tolerance level to use for the EM algorithm. Lower tolerances increase computation time. |
show.progress |
If |
call |
The function call. |
coefficients |
The estimated coefficients. |
fixed.effects |
The estimated individual fixed effects. |
fitted.values |
The fitted values of the model. |
residuals |
The model's residuals. |
model |
The |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | library(data.table)
set.seed(1)
# Create data:
N <- 200
nT <- 50
df <- data.table(id = rep(1:N, each = nT),
t = rep(1:nT, N))
# Individual fixed effects:
alpha <- (1:N - N/2)/(N/2)
df[, alpha := rep(alpha, each = nT)]
# Explanatory variable:
df[, x := rnorm(N * nT, mean = -2, sd = 0.5)]
# Coefficient to be estimated:
beta <- 0.5
# Latent variable:
df[, ystar := beta * x + alpha + rnorm(N * nT)]
# Observed variable:
df[, y := as.numeric(ystar > 0)]
# Estimate the model:
FEEMProbit(y ~ x | id, data = df, tol = 1e-6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.