R commands Flashcards

(15 cards)

1
Q

heteroskedasticity-robust SEs

A

coeftest(model, vcov = vcovHC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

cdf of standard normal distribution

A

pnorm(q)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

TSLS estimation

A

model <- ivreg(y ~ x1 + x2 | z + x2, data = your_data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

OLS estimation

A

model <- lm(y ~ x, data = your_data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

prediction

A

new_data <- data.frame(x = c(7,8,9))
predict(model, newdata = new_data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

confidence intervals

A

conf_intervals <- confint(model, level = 0.99)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

mean

A

mean(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

variance

A

var(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

correlation coefficient

A

correlation_coeff <- cor(x,y)
print(correlation_coeff)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

non-linear regression

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

fixed-effects regression

A

regr <- plm(data = your_data, formula = y ~ x, index = c(“state”, “year”), effect = “twoways”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

restricted hypothesis

A

linearHypothesis(reg1, “College + Female = 3”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

extracting residuals

A

residuals <- model$residuals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SSR

A

SSR <- sum(residuals^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

TSS

A

TSS <- sum((data$y - y_mean)^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly