fastplm | R Documentation |
fastplm
solves a fixed effects model or a 2SLS regression with fixed effects.
fastplm(data = NULL, formula = NULL, index = NULL, y = NULL, x = NULL, z = NULL, ind = NULL, sfe = NULL, cfe = NULL, PCA = TRUE, sp = NULL, knots = NULL, degree = 3, se = 1, vce = "robust", cluster = NULL, wild = TRUE, refinement = FALSE, test_x = NULL, parallel = TRUE, nboots = 200, seed = NULL, core.num = 1, drop.singletons = TRUE, bootcluster = NULL, iv.test = TRUE, first = FALSE, orthog = NULL, endog = NULL)
data |
An object of class "dataframe" or "matrix". If both |
formula |
An object of class "formula": a symbolic description of the model to be fitted. If it has the form "Y~1", the function merely estimates fixed effects. |
index |
A string vector specifying the indicators. Omissible if
|
y |
The Y matrix. Omissible if |
x |
The X matrix. Omissible if |
z |
A string vector of the names of all exogenous variables
(both of excluded IVs and included IVs) if |
ind |
A matrix where each row corresponds to the row (observation) in the
X-Y dataset and each column represents an effect. The entry of row X of effect
Y represents the group in Y that X belongs to.
Groups can be specified by either numbers or strings,
i.e. the input matrix can be of mode |
sfe |
A vector index of simple (additive) fixed effects.
Each can be specified either by effect name or position as in |
cfe |
A list index of complex fixed effects. Specifically, an complex fixed effect is a generalized fixed effect.
It consists a pair of two effects, (I, E), interacting with each other.
"I" stands for influence, whose level has an observed vector Each element is a vector whose length is 2. The 1st item of each element is the
index of effect and the 2nd item is the index of influence. For index, see
If omitted, complex fixed effects will not be estimated. |
PCA |
A logical flag indicating whether to perform principal
components analysis for influence in complex fixed effects (see |
sp |
A character value or a numeric vector specifying the variable for fitting a b-spline curve. |
knots |
A numeirc value specifying the knots point for |
degree |
A positive integer speficying the order of the spline curve.
Default value is |
se |
A logical flag indicating whether uncertainty estimates of
covariates will be produced. For 2sls regressions, all diagnostic tests will
not be conducted if |
vce |
A character value indicating type for variance estimator. Choose from: "standard" for standard ols standard errors, "robust" for the Huber White robust standard errors (default value), "clustered" (or "cl") for clustered standard errors, "jackknife" for jackknife standard errors, and "bootstrap" (or "boot") for bootstrapped standard errors. |
cluster |
A character value of the clustered variable(s) in the data frame if
|
wild |
A logical flag specifies if wild bootstrap will be performed to obtain
uncertainty estimates. Omissible if |
refinement |
A logical flag specifies if bootstrap refinement will be
performed to obtain uncertainty estimates. Omissible if |
test_x |
A character specifies the variable of interest for wild
bootstrap refinement. Omissible if |
parallel |
A logical flag indicating whether to perform parallel computing for the bootstrap procedure. Default to TRUE. |
nboots |
An integer specifying the number of bootstrap
runs. Omissible if |
seed |
An integer that sets the seed in random number generation.
Omissible if |
core.num |
The number of cores that will be used for computation. Default is one. Larger number of cores can improve the speed moderately. |
drop.singletons |
A logical flag indicating whether to drop
singletons(groups with only one observation). Default to TRUE.
The program can report the number of singletons it detects and return a vector
|
bootcluster |
A character value specifying the level of bootstrap in
two-way clustered bootstrap refinement.
Must be one of the names of |
iv.test |
A logical flag indicating whether to conduct diagnostic tests
for 2SLS regressions, including weak IV tests, exogeneity tests,
and endogeneity tests. Default to TRUE. Omissible if |
first |
A logical flag indicating whether to compute partial F statistics, Sanderson-Windmeijer (SW) F statistics and Angrist and Pischke (AP) F statistics for first stage regression for 2SLS estimation. Default to FALSE. |
orthog |
A character value(s) specifying the exogenous variables whose exogeneity is to be tested. A C-statistic will be calculated in this case. Default to NULL. |
endog |
A character value(s) specifying the endogenous variables whose endogeneity is to be tested. A C-statistic will be calculated in this case. Default to NULL. |
An object of class fastplm
with at least the following properties:
demeaned |
A list represents the demeaned linear model. It has, among other
properties, |
coefficients |
The coefficients for the demeaned linear model. |
sfe.coefs |
A list of estimated simple fixed effects. Each is a column
vector, in which row names correspond to names of levels in |
cfe.coefs |
A list of estimated complex fixed effects. Each is a matrix in
which each row represents a level. The naming convention is the same as in
|
fitted.values |
The fitted values of the fixed effect model. |
residuals |
The residuals of the fixed effect model, which is numerically the same as the residual of the demeaned linear model. |
intercept |
The intercept of the fixed effect model. Arbitrary if complex fixed effects are present. |
est.coefficients |
The estimated coefficients, standard errors and confidence intervals. |
vcov |
The estimated variance-covariance matrix of estimated coefficients. |
R2 |
Multiple R-squared(original model). |
Adj_R2 |
Adjusted multiple R-squared(original model). |
projR2 |
Multiple R-squared(demeaned model). |
projAdj_R2 |
Adjusted multiple R-squared(demeaned model). |
RMSE |
Root Mean Square Error. |
proj_F_statistic |
F-statistic. |
variance.type |
Type of standard errors and vcov matrices. |
num.singletons |
Number of singletons(groups with only one observation) the program detected. |
drop.index |
The original index of dropped singletons. |
inds |
As in the input. |
fe |
An object of "fixed.effects" created for intermediate computing. |
df.residual |
Degree of freedom. |
dof |
A list that stores the number of categories and the number of redundant categories in each level of fixed effects. |
refinement |
A list that restores results from wild/pairwise bootsrap refinement. |
tests |
Only for 2SLS regressions, stores the results of diagnostic tests. |
ols.model |
Only for 2SLS regressions, stores the results of the simple ols regression (only regress y on x). |
reduce.model |
Only for 2SLS regressions, stores the results of the reduced-form ols regression (regress y on all exogenous variables z). |
names |
Only for 2SLS regressions, stores the names of excluded instruments and included instruments. |
data(fastplm) out <- fastplm(y~x1+x2, index = c("country", "industry", "year"), data = simdata1, se = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.