Reputation: 55
How can I calculate the variance of and
estimator for a linear regression model where
?
Is there a function in R for finding the point estimator like mean, variance of these two estimator?
My data is
fit <- lm(log(TV.Drna$ppDr)~log(TV.Drna$ppTV),data=log(TV.Drna))
Upvotes: 1
Views: 2978
Reputation: 60472
You are after the vcov
function. After creating a simple reproducible data set
set.seed(1)
dd = data.frame(x = rnorm(10), y= rnorm(10))
and creating a lm
object
m = lm(y ~ x, data=dd)
You can access the variance-covariance matrix via
R> vcov(m)
(Intercept) x
(Intercept) 0.11394 -0.02662
x -0.02662 0.20136
You can access point estimates of your parameters via
coef(m)
Other useful statistics are accessed via summary(m)
.
Upvotes: 1