Estimate the mean of the independent variable (regression)

26 Views Asked by At

If I have the simple linear model: $y=\alpha+\beta x+\epsilon$, and I know that $\hat{\alpha}= \hat{\overline{y}}-\hat{\beta}\hat{\overline{x}}$.

Then my estimate og the mean is actually: $\hat{\overline{x}}=\frac{\hat{\overline{y}}-\hat{\alpha}}{\hat{\beta}}$

I'm trying to do this in R, with the lm(), but I don't know if this is correct.

    Call:
lm(formula = ult ~ vale)

Residuals:
    Min      1Q  Median      3Q     Max 
-278701  -34922  -13235   21227  940124 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 4.834e+04  7.337e+02   65.89   <2e-16 ***
vale        2.307e-04  5.874e-06   39.27   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 64480 on 13065 degrees of freedom
Multiple R-squared:  0.1056,    Adjusted R-squared:  0.1055 
F-statistic:  1542 on 1 and 13065 DF,  p-value: < 2.2e-16
1

There are 1 best solutions below

0
On
( mean(fitted(lm(formula = ult ~ vale))) - coef( lm(formula = ult ~ vale) )[1] ) / coef( lm(formula = ult ~ vale) )[2]