FEEMProbit: Estimate the individual fixed effects...

Description Usage Arguments Value Examples

View source: R/FEEMProbit.R

Description

Function to estimate the individual fixed effects expecation-maximization estimator in Chen (2016)

Usage

1
FEEMProbit(formula, data, tol = 1e-9, show.progress = FALSE)

Arguments

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, y ~ x1 + x2 | id, where id is the fixed effect

data

A data.frame.

tol

Tolerance level to use for the EM algorithm. Lower tolerances increase computation time.

show.progress

If TRUE, print the norm between parameter vectors in between each iteration.

Value

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 data.frame used to estimate the model.

Examples

 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)

walshc/FEEMProbit documentation built on May 3, 2019, 11:50 p.m.