[R] Some problem with the OLS

Charles C. Berry cberry at tajo.ucsd.edu
Wed Jun 11 17:58:23 CEST 2008


On Wed, 11 Jun 2008, roberto laforgia wrote:

> Dear all!!
>
> I estimated the following OLS model with R 2.5.6:
>
> Output R 2.5.6

You need to read and follow the posting guide AND provide a minimal, 
reproducible example.

What is R 2.5.6 ??

What do sessionInfo() or version report?

Where can I get a copy? ;-)

(Hint: Correct answer is NOT "on CRAN". There is not such version.)

>
> Call:
>
> lm(formula = UN ~ log(x) + time2, data = dati)
>
>
>
> Residuals:
>
>   Min     1Q Median     3Q    Max
>
> -5.649 -2.753 -1.015  1.225 16.199
>
>
>
> Coefficients:
>
>              Estimate Std. Error t value Pr(>|t|)
>
> (Intercept)  7.3036294  0.6871025  10.630   <2e-16 ***
>
> log(x)      -0.0028542  0.0270730  -0.105    0.916
>
> time2       -0.0002670  0.0003823  -0.698    0.487
>
> ---
>
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
>
>
> Residual standard error: 4.323 on 87 degrees of freedom
>
> Multiple R-Squared: 0.02933,    Adjusted R-squared: 0.007017
>
> F-statistic: 1.314 on 2 and 87 DF,  p-value: 0.2739
>
> is significant only the intercept
>
> After I estimated the same model with R 2.7 and this is the new output:
>
> Output R 2.7
>
> regressione14<-lm(UN ~ log(x)+ time2,data=dati)
>
>> summary(regressione14)
>
>
>
> Call:
>
> lm(formula = UN ~ log(x) + time2, data = dati)
>
>
>
> Residuals:
>
>   Min     1Q Median     3Q    Max
>
> -8.825 -2.094 -0.861  2.233 12.664
>
>
>
> Coefficients:
>
>             Estimate Std. Error t value Pr(>|t|)
>
> (Intercept) 22.724208   3.304670   6.876 8.89e-10 ***
>
> log(x)      -7.117981   1.499482  -4.747 8.05e-06 ***
>
> time2        0.002051   0.000523   3.922 0.000175 ***
>
> ---
>
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
>
>
> Residual standard error: 3.853 on 87 degrees of freedom
>
> Multiple R-Squared: 0.2289,     Adjusted R-squared: 0.2112
>
> F-statistic: 12.91 on 2 and 87 DF,  p-value: 1.227e-05
>
>
> Well, how you can see the two outputs are very differents, so i try to
> estimated the same model with another package and i show the
>
> output:
>
>
>
>
>
> *Variabile*
>
> *Coefficiente*
>
> *Errore Std.*
>
> *Statistica t*
>
> *p-value*
>
>
>
> const
>
> 22,7242
>
> 3,30467
>
> 6,8764
>
> <0,00001
>
> ***
>
> logx
>
> -7,11798
>
> 1,49948
>
> -4,7470
>
> <0,00001
>
> ***
>
> time2
>
> 0,00205144
>
> 0,000523012
>
> 3,9224
>
> 0,00017
>
> ***
>
>
>
>            Media della variabile dipendente = 6,47833
>
>            Scarto quadratico medio della variabile dipendente = 4,33827
>
>            Somma dei quadrati dei residui = 1291,58
>
>            Errore standard dei residui = 3,85302
>
>            R2 = 0,228922
>
>            R2 corretto = 0,211196
>
>            Statistica F (2, 87) = 12,9145 (p-value = 1,23e-005)
>
>            Log-verosimiglianza = -247,576
>
>            Criterio di informazione di Akaike = 501,152
>
>            Criterio bayesiano di Schwarz = 508,652
>
>            Criterio di Hannan-Quinn = 504,176
>
>  How you can see this package show the same output of the R 2.7
>
> My question is where is the bug?
>
>
>
> Kind regards
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list