R commands Flashcards
(15 cards)
heteroskedasticity-robust SEs
coeftest(model, vcov = vcovHC)
cdf of standard normal distribution
pnorm(q)
TSLS estimation
model <- ivreg(y ~ x1 + x2 | z + x2, data = your_data)
OLS estimation
model <- lm(y ~ x, data = your_data)
prediction
new_data <- data.frame(x = c(7,8,9))
predict(model, newdata = new_data)
confidence intervals
conf_intervals <- confint(model, level = 0.99)
mean
mean(data)
variance
var(data)
correlation coefficient
correlation_coeff <- cor(x,y)
print(correlation_coeff)
non-linear regression
model1 <- lm(testscr ~ x + I(x^2) + I(x^3) + I(x^4), data = your_data)
model2 <- lm(I(ln(testscr)) ~ I(ln(x)), data = your_data)
fixed-effects regression
regr <- plm(data = your_data, formula = y ~ x, index = c(“state”, “year”), effect = “twoways”)
restricted hypothesis
linearHypothesis(reg1, “College + Female = 3”)
extracting residuals
residuals <- model$residuals
SSR
SSR <- sum(residuals^2)
TSS
TSS <- sum((data$y - y_mean)^2)