[R] Exact p-values in lm() - rounding problem

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Feb 12 15:21:23 CET 2013



On 12.02.2013 15:15, Torvon wrote:
> The code is quite long because I am running a WLS regression instead of an
> OLS regression (due to heteroscedasticity). First, I get mean structure,
> then get mean/SD relationship, then improve the variance structure by using
> weights proportional to 1/variance.
>
> I am quite sure this is not relevant, so I will only post the rest of the
> code. Let me know if you need that part, too. I appreciate the help Uwe!
>
> Best,
> T.
>
>
> m3 = lm(s8_1234_m~ Sex + HisDep + FamHis + ZNeuro + ZEFE + Zwh_1234_m +
>    Zale_1234_m+t0s8, weights=W, data=D)
>
>
>> summary(m3)
>
> Call:
> lm(formula = s8_1234_m ~ Sex + HisDep + FamHis + ZNeuro + ZEFE +
>      Zwh_1234_m + Zale_1234_m + t0s8, data = D, weights = W)
>
> Residuals:
>      Min      1Q  Median      3Q     Max
> -1.3691 -0.5453 -0.4104  0.2606  7.0111
>
> Coefficients:
>              Estimate Std. Error t value Pr(>|t|)
> (Intercept)  0.20961    0.01681  12.472  < 2e-16 ***
> Sex         -0.02321    0.01708  -1.359  0.17435
> HisDep       0.02544    0.01987   1.281  0.20052
> FamHis      -0.02183    0.01798  -1.215  0.22478
> ZNeuro       0.07939    0.01007   7.882 6.87e-15 ***
> ZEFE         0.02243    0.01056   2.124  0.03385 *
> Zwh_1234_m   0.04265    0.00814   5.240 1.88e-07 ***
> Zale_1234_m  0.02877    0.00975   2.951  0.00323 **
> t0s8         0.38980    0.06504   5.993 2.67e-09 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Residual standard error: 0.9321 on 1280 degrees of freedom
> Multiple R-squared: 0.1282, Adjusted R-squared: 0.1228
> F-statistic: 23.54 on 8 and 1280 DF,  p-value: < 2.2e-16
>
>> coef(summary(m1))[,4]
>   (Intercept)          Sex       HisDep       FamHis       ZNeuro
> ZEFE   Zwh_1234_m  Zale_1234_m
> 3.042584e-23 2.146371e-01 2.769561e-01 9.988154e-01 5.682278e-13
> 5.243800e-03 2.599513e-07 3.116738e-02
>          t0s8
> 1.741608e-17

So you are comparing results from m3 with those from m1????


Uwe Ligges


>
>
>
> On 12 February 2013 15:07, Uwe Ligges <ligges at statistik.tu-dortmund.de>wrote:
>
>>
>>
>> On 12.02.2013 14:44, Torvon wrote:
>>
>>>
>>>
>>> Thank you, Uwe.
>>>
>>> summary(m1) gives me p-value estimates of:
>>> (Intercept) 2e-16
>>> x1 6.9e-15
>>> x2 1.9e-07
>>> x3 2.7e-09
>>>
>>> While coef(summary(m1))[,4] gives me:
>>> (Intercept) 3.0e-23
>>> x1 5.7e-13
>>> x2 2.6e-07
>>> x3 1.7e-17
>>>
>>> While the first one confirms my suspicion (-23 instead of -16), the
>>> latter one vary drastically (especially x3 from -09 to -17). Why is that?
>>>
>>
>>
>> Can you show the complete code and output?
>>
>> Uwe Ligges
>>
>>   Thank you!
>>> T.
>>>
>>>
>>>
>
> 	[[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.
>



More information about the R-help mailing list