betahat
betahat

Reputation: 55

How to find the variance of a linear regression estimator?

How can I calculate the variance of enter image description here and enter image description here estimator for a linear regression model where enter image description here?

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

Answers (1)

csgillespie
csgillespie

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

Related Questions