Description Usage Arguments Value Note Examples
Function performs default regression via ordinary least squares in step-wise fashion.
That is, it iteratively includes an additional regressor one-by-one. It also supports dummy
variables which are not included in the dataset data
, but in a global variable
attached to a formula. With this input, this function can filter for a subset, remove
outliers at a certain cutoff and remove dummies that are NA.
1 2 |
formula |
of type |
data |
An optional data frame contain the variables in the model (excluding the dummy variables). |
subset |
Vector of integers or booleans defining the subset of observations to be used. |
dummies |
String denoting the name of the variable (i.e. matrix or data frame) containing all dummy variables. |
cutoff |
Relative cutoff on each side in percent (default: |
rmDummyNA |
Boolean indicating whether to remove dummy variables with NA coefficient (default: removal). |
vcov |
Estimator used for computing the covariance matrix. Default is |
Returns a list with different, estimated models.
The dummy term is included in all regressions (if present).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | x1 <- 1:100
x2 <- sin(1:100)
clusters <- rep(c(1, 2), 50)
dummies <- model.matrix(~ clusters)
y <- x1 + x2 + clusters + rnorm(100)
d <- data.frame(x1 = x1, x2 = x2, y = y)
models <- regressionStepwise(formula("y ~ x1 + x2 + dummies"), data = d, subset = 1:90,
dummies = "dummies", cutoff = 0.5)
length(models)
library(texreg)
texreg(models, omit.coef = "dummies")
library(sandwich)
models <- regressionStepwise(formula("y ~ x1 + x2 + dummies"), data = d, subset = 1:90,
dummies = "dummies", cutoff = 0.5, vcov = NeweyWest)
texreg(models, omit.coef = "dummies")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.