Re: [R] Differences in output of lme() when introducing interactions

2015-07-24 Thread John Kane
I clearly am going to have to improve my stats knowledge by reading McPhearson. 
To heck with Senn- too complicated. :)

Thanks Terry.

John Kane
Kingston ON Canada


 -Original Message-
 From: thern...@mayo.edu
 Sent: Thu, 23 Jul 2015 14:07:00 -0500
 To: r.tur...@auckland.ac.nz, thern...@mayo.edu
 Subject: Re: [R] Differences in output of lme() when introducing
 interactions
 
 The following are in parody (but like all good parody correct wrt the
 salient features).
 The musings of
 Guernsey McPhearson
 http://www.senns.demon.co.uk/wprose.html#Mixed
 http://www.senns.demon.co.uk/wprose.html#FDA
 
 
 In formal publication:
   Senn, Statistical Issues in Drug Development, second edition, Chapter
 14: Multicentre Trials
   Senn, The many modes of meta, Drug information journal, 34:535-549,
 2000.
 
 The second points out that in a meta analysis no one would ever consider
 giving both large
 and small trials equal weights, and relates that to several other bits of
 standard
 practice.  The 'equal weights' notion embedded in a fixed effects model +
 SAS type 3 is an
 isolated backwater.
 
 Terry T.
 
 PS. The Devils' Drug Development Dictionary at the same source has some
 gems. Three
 rather random choices:
 
 Bayesian - One who, vaguely expecting a horse and catching a glimpse of a
 donkey, strongly
 concludes he has seen a mule.
 
 Medical Statistician - One who won't accept that Columbus discovered
 America because he
 said he was looking for India in the trial Plan.
 
 Trend Towards Significance - An ever present help in times of trouble.
 
 
 
 On 07/22/2015 06:02 PM, Rolf Turner wrote:
 On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:
 
 SNIP
 
 3. Should you ever use it [i.e. Type III SS]?  No.  There is a very
 strong inverse
 correlation between understand what it really is and recommend its
 use.   Stephen Senn has written very intellgently on the issues.
 
 Terry --- can you please supply an explicit citation?  Ta.
 
 cheers,
 
 Rolf
 
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-23 Thread Rolf Turner

On 24/07/15 07:07, Therneau, Terry M., Ph.D. wrote:

The following are in parody (but like all good parody correct wrt the
salient features). The musings of
Guernsey McPhearson
http://www.senns.demon.co.uk/wprose.html#Mixed
http://www.senns.demon.co.uk/wprose.html#FDA


In formal publication:
  Senn, Statistical Issues in Drug Development, second edition, Chapter
14: Multicentre Trials
  Senn, The many modes of meta, Drug information journal, 34:535-549, 2000.

The second points out that in a meta analysis no one would ever consider
giving both large and small trials equal weights, and relates that to
several other bits of standard practice.  The 'equal weights' notion
embedded in a fixed effects model + SAS type 3 is an isolated backwater.

Terry T.

PS. The Devils' Drug Development Dictionary at the same source has
some gems. Three rather random choices:

Bayesian - One who, vaguely expecting a horse and catching a glimpse of
a donkey, strongly concludes he has seen a mule.

Medical Statistician - One who won't accept that Columbus discovered
America because he said he was looking for India in the trial Plan.

Trend Towards Significance - An ever present help in times of trouble.



On 07/22/2015 06:02 PM, Rolf Turner wrote:

On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:

SNIP


3. Should you ever use it [i.e. Type III SS]?  No.  There is a very
strong inverse
correlation between understand what it really is and recommend its
use.   Stephen Senn has written very intellgently on the issues.


Terry --- can you please supply an explicit citation?  Ta.


Thanks Terry!

cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-23 Thread Therneau, Terry M., Ph.D.
The following are in parody (but like all good parody correct wrt the salient features). 
The musings of

Guernsey McPhearson
   http://www.senns.demon.co.uk/wprose.html#Mixed
   http://www.senns.demon.co.uk/wprose.html#FDA


In formal publication:
 Senn, Statistical Issues in Drug Development, second edition, Chapter 14: 
Multicentre Trials
 Senn, The many modes of meta, Drug information journal, 34:535-549, 2000.

The second points out that in a meta analysis no one would ever consider giving both large 
and small trials equal weights, and relates that to several other bits of standard 
practice.  The 'equal weights' notion embedded in a fixed effects model + SAS type 3 is an 
isolated backwater.


Terry T.

PS. The Devils' Drug Development Dictionary at the same source has some gems. Three 
rather random choices:


Bayesian - One who, vaguely expecting a horse and catching a glimpse of a donkey, strongly 
concludes he has seen a mule.


Medical Statistician - One who won't accept that Columbus discovered America because he 
said he was looking for India in the trial Plan.


Trend Towards Significance - An ever present help in times of trouble.



On 07/22/2015 06:02 PM, Rolf Turner wrote:

On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:

SNIP


3. Should you ever use it [i.e. Type III SS]?  No.  There is a very strong 
inverse
correlation between understand what it really is and recommend its
use.   Stephen Senn has written very intellgently on the issues.


Terry --- can you please supply an explicit citation?  Ta.

cheers,

Rolf



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-22 Thread Therneau, Terry M., Ph.D.
Type III is a peculiarity of SAS, which has taken root in the world.  There are 3 main 
questions wrt to it:


1. How to compute it (outside of SAS).  There is a trick using contr.treatment coding that 
works if the design has no missing factor combinations, your post has a link to such a 
description.  The SAS documentation is very obtuse, thus almost no one knows how to 
compute the general case.


2. What is it?  It is a population average.  The predicted average treatment effect in a 
balanced population-- one where all the factor combinations appeared the same number of 
times.  One way to compute 'type 3' is to create such a data set, get all the predicted 
values, and then take the average prediction for treatment A, average for treatment B, 
average for C, ...  and test are these averages the same.   The algorithm of #1 above 
leads to another explanation which is a false trail, in my opinion.


3. Should you ever use it?  No.  There is a very strong inverse correlation between 
understand what it really is and recommend its use.   Stephen Senn has written very 
intellgently on the issues.


Terry Therneau


On 07/22/2015 05:00 AM, r-help-requ...@r-project.org wrote:

Dear Michael,
thanks a lot. I am studying the marginality and I came across to this post:

http://www.ats.ucla.edu/stat/r/faq/type3.htm

Do you think that the procedure there described is the right one to solve my 
problem?

Would you have any other online resources to suggest especially dealing with R?

My department does not have a statician, so I have to find a solution with my 
own capacities.

Thanks in advance

Angelo


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-22 Thread Rolf Turner

On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:

SNIP


3. Should you ever use it [i.e. Type III SS]?  No.  There is a very strong 
inverse
correlation between understand what it really is and recommend its
use.   Stephen Senn has written very intellgently on the issues.


Terry --- can you please supply an explicit citation?  Ta.

cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-22 Thread Marc Schwartz
Hi,

In addition to Terry’s great comments below, as this subject has come up 
frequently over the years, there is also a great document by Bill Venables that 
is valuable reading:

  Exegeses on Linear Models
  http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf


Regards,

Marc Schwartz


 On Jul 22, 2015, at 8:15 AM, Therneau, Terry M., Ph.D. thern...@mayo.edu 
 wrote:
 
 Type III is a peculiarity of SAS, which has taken root in the world.  There 
 are 3 main questions wrt to it:
 
 1. How to compute it (outside of SAS).  There is a trick using 
 contr.treatment coding that works if the design has no missing factor 
 combinations, your post has a link to such a description.  The SAS 
 documentation is very obtuse, thus almost no one knows how to compute the 
 general case.
 
 2. What is it?  It is a population average.  The predicted average treatment 
 effect in a balanced population-- one where all the factor combinations 
 appeared the same number of times.  One way to compute 'type 3' is to create 
 such a data set, get all the predicted values, and then take the average 
 prediction for treatment A, average for treatment B, average for C, ...  and 
 test are these averages the same.   The algorithm of #1 above leads to 
 another explanation which is a false trail, in my opinion.
 
 3. Should you ever use it?  No.  There is a very strong inverse correlation 
 between understand what it really is and recommend its use.   Stephen 
 Senn has written very intellgently on the issues.
 
 Terry Therneau
 
 
 On 07/22/2015 05:00 AM, r-help-requ...@r-project.org wrote:
 Dear Michael,
 thanks a lot. I am studying the marginality and I came across to this post:
 
 http://www.ats.ucla.edu/stat/r/faq/type3.htm
 
 Do you think that the procedure there described is the right one to solve my 
 problem?
 
 Would you have any other online resources to suggest especially dealing with 
 R?
 
 My department does not have a statician, so I have to find a solution with 
 my own capacities.
 
 Thanks in advance
 
 Angelo

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Differences in output of lme() when introducing interactions

2015-07-20 Thread Michael Dewey

In-line

On 20/07/2015 15:10, angelo.arc...@virgilio.it wrote:

Dear List Members,



I am searching for correlations between a dependent variable and a
factor or a combination of factors in a repeated measure design. So I
use lme() function in R. However, I am getting very different results
depending on whether I add on the lme formula various factors compared
to when only one is present. If a factor is found to be significant,
shouldn't remain significant also when more factors are introduced in
the model?



The short answer is 'No'.

The long answer is contained in any good book on statistics which you 
really need to have by your side as the long answer is too long to 
include in an email.




I give an example of the outputs I get using the two models. In the first model 
I use one single factor:

library(nlme)
summary(lme(Mode ~ Weight, data = Gravel_ds, random = ~1 | Subject))
Linear mixed-effects model fit by REML
  Data: Gravel_ds
   AIC  BIC   logLik
   2119.28 2130.154 -1055.64

Random effects:
  Formula: ~1 | Subject
 (Intercept) Residual
StdDev:1952.495 2496.424

Fixed effects: Mode ~ Weight
 Value Std.Error DF   t-value p-value
(Intercept) 10308.966 2319.0711 95  4.445299   0.000
Weight-99.036   32.3094 17 -3.065233   0.007
  Correlation:
(Intr)
Weight -0.976

Standardized Within-Group Residuals:
 Min  Q1 Med  Q3 Max
-1.74326719 -0.41379593 -0.06508451  0.39578734  2.27406649

Number of Observations: 114
Number of Groups: 19


As you can see the p-value for factor Weight is significant.
This is the second model, in which I add various factors for searching their 
correlations:

library(nlme)
summary(lme(Mode ~ Weight*Height*Shoe_Size*BMI, data = Gravel_ds, random = ~1 | 
Subject))
Linear mixed-effects model fit by REML
  Data: Gravel_ds
AIC  BIClogLik
   1975.165 2021.694 -969.5825

Random effects:
  Formula: ~1 | Subject
 (Intercept) Residual
StdDev:1.127993 2494.826

Fixed effects: Mode ~ Weight * Height * Shoe_Size * BMI
 Value Std.Error DFt-value p-value
(Intercept)   5115955  10546313 95  0.4850941  0.6287
Weight  -13651237   6939242  3 -1.9672518  0.1438
Height -18678 53202  3 -0.3510740  0.7487
Shoe_Size   93427213737  3  0.4371115  0.6916
BMI -13011088   7148969  3 -1.8199949  0.1663
Weight:Height   28128 14191  3  1.9820883  0.1418
Weight:Shoe_Size   351453186304  3  1.8864467  0.1557
Height:Shoe_Size -783  1073  3 -0.7298797  0.5183
Weight:BMI  19475 11425  3  1.7045450  0.1868
Height:BMI 226512118364  3  1.9136867  0.1516
Shoe_Size:BMI  329377190294  3  1.7308827  0.1819
Weight:Height:Shoe_Size  -706   371  3 -1.9014817  0.1534
Weight:Height:BMI-10963  3 -1.7258742  0.1828
Weight:Shoe_Size:BMI -273   201  3 -1.3596421  0.2671
Height:Shoe_Size:BMI-5858  3200  3 -1.8306771  0.1646
Weight:Height:Shoe_Size:BMI 2 1  3  1.3891782  0.2589
  Correlation:
 (Intr) Weight Height Sho_Sz BMIWght:H Wg:S_S 
Hg:S_S Wg:BMI Hg:BMI S_S:BM Wg:H:S_S W:H:BM W:S_S: H:S_S:
Weight  -0.895
Height  -0.996  0.869
Shoe_Size   -0.930  0.694  0.933
BMI -0.911  0.998  0.887  0.720
Weight:Height0.894 -1.000 -0.867 -0.692 -0.997
Weight:Shoe_Size 0.898 -0.997 -0.873 -0.700 -0.999  0.995
Height:Shoe_Size 0.890 -0.612 -0.904 -0.991 -0.641  0.609  0.619
Weight:BMI   0.911 -0.976 -0.887 -0.715 -0.972  0.980  0.965  
0.637
Height:BMI   0.900 -1.000 -0.875 -0.703 -0.999  0.999  0.999  
0.622  0.973
Shoe_Size:BMI0.912 -0.992 -0.889 -0.726 -0.997  0.988  0.998  
0.649  0.958  0.995
Weight:Height:Shoe_Size -0.901  0.999  0.876  0.704  1.000 -0.997 -1.000 
-0.623 -0.971 -1.000 -0.997
Weight:Height:BMI   -0.908  0.978  0.886  0.704  0.974 -0.982 -0.968 
-0.627 -0.999 -0.975 -0.961  0.973
Weight:Shoe_Size:BMI-0.949  0.941  0.928  0.818  0.940 -0.946 -0.927 
-0.751 -0.980 -0.938 -0.924  0.9350.974
Height:Shoe_Size:BMI-0.901  0.995  0.878  0.707  0.998 -0.992 -1.000 
-0.627 -0.960 -0.997 -0.999  0.9990.964  0.923
Weight:Height:Shoe_Size:BMI  0.952 -0.948 -0.933 -0.812 -0.947  0.953  0.935  
0.747  0.985  0.946  0.932 -0.943   -0.980 -0.999 -0.931

Standardized Within-Group Residuals:
 Min  Q1 Med  Q3 Max
-2.03523736 -0.47889716 -0.02149143  0.41118126  2.20012158

Number of Observations: 114
Number of Groups: 19


This time the p-value associated to Weight is not significant anymore. Why?