Description Usage Arguments Examples
Function performs default regression via ordinary least squares. 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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x <- 1:100
clusters <- rep(c(1, 2), 50)
dummies <- model.matrix(~ clusters)
y <- x + clusters + rnorm(100)
d <- data.frame(x = x, y = y)
m <- regression(formula("y ~ x + dummies"), data = d, subset = 1:90,
dummies = "dummies", cutoff = 0.5)
summary(m)
library(sandwich)
m <- regression(formula("y ~ x + dummies"), data = d, subset = 1:90,
dummies = "dummies", cutoff = 0.5, vcov = NeweyWest)
summary(m)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.