From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>

Date: Mon, 17 Dec 2007 19:31:06 +0100

Date: Mon, 17 Dec 2007 19:31:06 +0100

Troels Ring wrote:

> Dear friends, regression towards the mean is interesting in medical

*> circles, and a very recent paper (The American Statistician November
**> 2007;61:302-307 by Krause and Pinheiro) treats it at length. An initial
**> example specifies (p 303):
**> "Consider the following example: we draw 100 samples from a bivariate
**> Normal distribution with X0~N(0,1), X1~N(0,1) and cov(X0,X1)=0.7, We
**> then calculate the p value for the null hypothesis that the means of X0
**> and X1 are equal, using a paired Student's t test. The procedure is
**> repeated 1000 times, producing 1000 simulated p values. Because X0 and
**> X1 have identical marginal distributions, the simulated p values behave
**> like independent Uniform(0,1) random variables." This I did not
**> understand, and simulating like shown below produced far from uniform
**> (0,1) p values - but I fail to see how it is wrong. I contacted the
**> authors of the paper but they did not answer. So, please, doesn´t the
**> code below specify a bivariate N(0,1) with covariance 0.7? I get p
**> values = 1 all over - not interesting, but how wrong?
**> Best wishes
**> Troels
**>
**> library(MASS)
**> Sigma <- matrix(c(1,0.7,0.7,1),2,2)
**> Sigma
**> res <- NULL
**> for (i in 1:1000){
**> ff <-(mvrnorm(n=100, rep(0, 2), Sigma, empirical = TRUE))
**> res[i] <- t.test(ff[,1],ff[,2],paired=TRUE)$p.value}
**>
**>
*

You do not want empirical=TRUE in the mvrnorm call. This pegs the
empirical means to exactly (0,0) which are obviously never significantly
different.

BTW, there's a function called replicate()...

-- O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ 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.Received on Mon 17 Dec 2007 - 18:40:31 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 19:30:20 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*