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

2013-02-12 Thread Uwe Ligges



On 12.02.2013 13:37, Torvon wrote:

I need to report exact p-values in my dissertation. Looking at my lm()
results of many regressions with huge datasets I have the feeling that
p-values are rounded to the smallest value of 2e-16, because this p-value
is very common.

Is that true or just chance? If it is true, how do I obtain the true
unrounded p-values for these regressors?

m1 - lm(y ~ x1+x2+x3+4+x5, data=D)


coef(summary(m1))[,4]

Anyway, you should not believe that smaller values are still accurate. 
Always worry about the numerics when looking at tiny differences.


Best,
Uwe Ligges





Thank you
Torvon

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


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

2013-02-12 Thread Torvon
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?

Thank you!
T.

[[alternative HTML version deleted]]

__
R-help@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.


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

2013-02-12 Thread Ben Bolker
Torvon torvon at gmail.com writes:

 
 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?

  This looks fishy.  Could we please have a reproducible example?
For example, give us the results of dput(summary(m1)) ...

When I try this with example(lm) it works fine:

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)   5.0320 0.2202  22.850 9.55e-15 ***
groupTrt -0.3710 0.3114  -1.1910.249

 coef(summary(lm.D9))[,4]
 (Intercept) groupTrt 
9.547128e-15 2.490232e-01

__
R-help@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.


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

2013-02-12 Thread Uwe Ligges



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.




__
R-help@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.


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

2013-02-12 Thread Torvon
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.209610.01681  12.472   2e-16 ***
Sex -0.023210.01708  -1.359  0.17435
HisDep   0.025440.01987   1.281  0.20052
FamHis  -0.021830.01798  -1.215  0.22478
ZNeuro   0.079390.01007   7.882 6.87e-15 ***
ZEFE 0.022430.01056   2.124  0.03385 *
Zwh_1234_m   0.042650.00814   5.240 1.88e-07 ***
Zale_1234_m  0.028770.00975   2.951  0.00323 **
t0s8 0.389800.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



On 12 February 2013 15:07, Uwe Ligges lig...@statistik.tu-dortmund.dewrote:



 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@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.


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

2013-02-12 Thread Uwe Ligges



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.209610.01681  12.472   2e-16 ***
Sex -0.023210.01708  -1.359  0.17435
HisDep   0.025440.01987   1.281  0.20052
FamHis  -0.021830.01798  -1.215  0.22478
ZNeuro   0.079390.01007   7.882 6.87e-15 ***
ZEFE 0.022430.01056   2.124  0.03385 *
Zwh_1234_m   0.042650.00814   5.240 1.88e-07 ***
Zale_1234_m  0.028770.00975   2.951  0.00323 **
t0s8 0.389800.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 lig...@statistik.tu-dortmund.dewrote:




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@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.



__
R-help@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.


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

2013-02-12 Thread Torvon
I'm sorry, no clue how I did not see that. Thank you!


On 12 February 2013 15:21, Uwe Ligges lig...@statistik.tu-dortmund.dewrote:



 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.209610.01681  12.472   2e-16 ***
 Sex -0.023210.01708  -1.359  0.17435
 HisDep   0.025440.01987   1.281  0.20052
 FamHis  -0.021830.01798  -1.215  0.22478
 ZNeuro   0.079390.01007   7.882 6.87e-15 ***
 ZEFE 0.022430.01056   2.124  0.03385 *
 Zwh_1234_m   0.042650.00814   5.240 1.88e-07 ***
 Zale_1234_m  0.028770.00975   2.951  0.00323 **
 t0s8 0.389800.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 
 lig...@statistik.tu-dortmund.**delig...@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@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@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.