OLS Estimation
Estimate the regression coefficients using
find_beta:
beta_hat <- find_beta(y, X)
beta_hat
#> X1 X2 X3
#> 1.933844 1.107640 -0.751965Confidence Interval for a Linear Combination
Construct a 95% confidence interval for (the coefficient of X1):
Constrained Estimation
Suppose we want to estimate the coefficients under the constraint :
C <- matrix(c(0, 1, 1), nrow = 1) # Constraint: beta_2 + beta_3 = 0
d <- 0
beta_hat_H <- find_betaH(y, X, C, d)
beta_hat_H
#> [,1]
#> [1,] 1.9671298
#> [2,] 0.9359443
#> [3,] -0.9359443F-test for Linear Restrictions (RSS method)
Test the null hypothesis using the F-test based on RSS:
f_rss <- f_test_RSS(y, X, C, d)
f_rss
#> $F_statistic
#> [1] 6.174057
#>
#> $p_value
#> [1] 0.01467634F-test for Linear Restrictions (Quadratic form)
Alternatively, use the quadratic form for the same test:
f_quad <- f_test_quad(y, X, C, d)
f_quad
#> $F_statistic
#> [1] 6.174057
#>
#> $p_value
#> [1] 0.01467634