#dm1
dm1 %>%
transmute(
Y = log(S30/S),
X = log(`F`/S)
) ->
god1
god1 %>%
lm(Y ~ X, data = .) ->
lm_god1
lm_god1 %>%
summary()
##
## Call:
## lm(formula = Y ~ X, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.114915 -0.019740 0.002125 0.019888 0.100061
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.011315 0.002472 -4.578 5.47e-06 ***
## X -3.014681 0.662965 -4.547 6.30e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03343 on 776 degrees of freedom
## Multiple R-squared: 0.02595, Adjusted R-squared: 0.0247
## F-statistic: 20.68 on 1 and 776 DF, p-value: 6.303e-06
lm_god1$residuals %>%
ts() %>%
as.timeSeries() ->
ts_god1
ts_god1$SS.1 %>%
acf(main="ACF of index returns")
Ans. Yes, the autocorrelation appear to vanish after 4 lags.
test whether \(\beta_{0} = 0\)
lm_god1 %>%
coeftest(vcov. = vcovHAC, type = "HC1")
##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.0113149 0.0047611 -2.3765 0.01772 *
## X -3.0146811 1.2492680 -2.4132 0.01605 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
test whether \(\beta_{1} = 1\)
library(multcomp)
glht(
lm_god1, linfct = "X = 1"
) %>%
summary()
##
## Simultaneous Tests for General Linear Hypotheses
##
## Fit: lm(formula = Y ~ X, data = .)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## X == 1 -3.015 0.663 -6.056 2.18e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)