Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread William Dunlap
noblauch > Sent: Tuesday, December 08, 2009 7:36 AM > To: r-devel@r-project.org > Subject: [Rd] lower.tail option in pnorm > > Hi, > > I would have thought that these two constructions would > produce the same result but they do not. > > Resp <- rbinom(10, 1, 0.5

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ravi Varadhan
ric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Ken Knoblauch Date: Tuesday, December 8, 2009 10:37 am Subject: [Rd] lower.tail option in pnorm To: r-devel@r-project.org > Hi, > >

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ken Knoblauch
Thank you. That explains it. I didn't read closely enough. best, Ken Quoting Prof Brian Ripley : From the help page: pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) x,q: vector of quantiles. lower.tail: logical; if TRUE (default), probabilities are P[X <= x],

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ben Bolker
Ken Knoblauch inserm.fr> writes: > > Hi, > > I would have thought that these two constructions would > produce the same result but they do not. > > Resp <- rbinom(10, 1, 0.5) > Stim <- rep(0:1, 5) > mm <- model.matrix(~ Stim) > Xb <- mm %*% c(0, 1) > ifelse(Resp, log(pnorm(Xb)), log(1 - pnorm(

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Prof Brian Ripley
From the help page: pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) x,q: vector of quantiles. lower.tail: logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. Note that lower.tail is not said to be a vector, and the first value is tak

[Rd] lower.tail option in pnorm

2009-12-08 Thread Ken Knoblauch
Hi, I would have thought that these two constructions would produce the same result but they do not. Resp <- rbinom(10, 1, 0.5) Stim <- rep(0:1, 5) mm <- model.matrix(~ Stim) Xb <- mm %*% c(0, 1) ifelse(Resp, log(pnorm(Xb)), log(1 - pnorm(Xb))) pnorm(as.vector(Xb), lower.tail = Resp, log.p = TRU