5
$\begingroup$

I am running a linear regression model in R:

data(iris)
fit1.iris = lm(Sepal.Length ~ Petal.Length+Petal.Width , data=iris) 
summary(fit1.iris)

These are my coefficients:

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)   4.19058    0.09705  43.181  < 2e-16 ***
Petal.Length  0.54178    0.06928   7.820 9.41e-13 ***
Petal.Width  -0.31955    0.16045  -1.992   0.0483 * 

I am trying to plot the density curve for parameter estimates, and below is how I did it for intercept. Am I doing it right ?

  fit_iris = lm(Sepal.Length~ Petal.Length+Petal.Width , data=iris, x=TRUE, y=TRUE)
  summary(fit_iris)
  x_iris = seq(0, 10, length.out=1000)
  plot(density(dnorm(x,4.190582,0.09705)), type='l')
$\endgroup$
4
  • $\begingroup$ You've tagged this question with normal-distribution so I assume you know that each of the parameter estimates is assumed to be normally distributed. The normal distribution is parameterized by its mean and variance. Once you locate the means and variances of each of your parameter estimates, look into the dnorm function. $\endgroup$ Dec 19, 2014 at 19:50
  • $\begingroup$ @Penguin_Knight, sorry I dont think that was correct. I don't know if it follows normal distribution or not. $\endgroup$
    – Science11
    Dec 19, 2014 at 20:30
  • $\begingroup$ @Science11, do you mean @Max? That was Max's comment. I simply corrected a typo in the title. Regards. $\endgroup$ Dec 19, 2014 at 20:36
  • $\begingroup$ @Max oops sorry :) $\endgroup$
    – Science11
    Dec 19, 2014 at 20:48

2 Answers 2

6
$\begingroup$

You also could use bootstrap estimates.

library(boot)
f <- function(data, d) coef(lm(Sepal.Length ~ Petal.Length+Petal.Width , data=data[d,])) 
boot.fit <- boot(iris, f, 1000)

Now, estimating the density for the Petal.Length coefficient as an example:

petal.density <- density(boot.fit$t[,2])
plot(petal.density, main = "Petal Length Density")

enter image description here

$\endgroup$
0
6
$\begingroup$

Under usual conditions the parameter estimates end up being asymptotically normal. You can find the proof in any econometrics textbook. Additionally, if your errors are normal, then parameters would be normal even in small samples.

So, assuming that the parameter estimates are normal, you can graph them with any plotting function. Draw a normal distribution with mean and standard error equal to parameter estimate and its standard error.

$\endgroup$
1
  • 1
    $\begingroup$ In the usual framework, parameters are fixed quantities. The distribution of the estimator of a parameter may be asymptotically normal. $\endgroup$
    – Glen_b
    Dec 21, 2014 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.