Re: [R] 1-pnorm values in a table

From: Jabez Wilson <>
Date: Thu, 06 Mar 2008 16:33:46 +0000 (GMT)

  <Richard.Cotton <at>> writes:    

> Try:
> nrows <- 5
> mm <- matrix(rnorm(30),nrow=nrows)
> <- apply(mm,2,sd)
> <- apply(mm,2,mean)
> values <- 1-mapply(pnorm, q=as.vector(mm), mean=rep(,
> nrows)), sd=rep(, nrows))) values <- matrix(values, nrow=5)
> > p.s. I know I'm asking a lot, but ideally, I'd like to print out
> > the table with those 1-pnorm values only if they are in the right
> > hand tail (i.e. >= mean) and if not nothing or NA be written.
> values[values<.5] <- NA

  I'm not sure, but I think that
  nrows <- 5
  mm <- matrix(rnorm(30),nrow=nrows)
  values[values<.5] <- NA
  will do the same thing.
  lower.tail=FALSE is a little more accurate than 1-pnorm(...)   cheers
  Ben Bolker        

  Brilliant! I am in awe....    

  Thanks for the other contributions    

  Jab     mailing list   PLEASE do read the posting guide   and provide commented, minimal, self-contained, reproducible code.        

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 06 Mar 2008 - 16:41:41 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 Thu 06 Mar 2008 - 17:30:20 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive