Displaying 20 results from an estimated 11000 matches similar to: "decimal accuracy in pnorm( )"
2002 Feb 13
3
pnorm, relative accuracy in the tails
Dear R people
The function below should be decreasing, convex, and tend to zero when x
tends to infinity.
curve((1-pnorm(x))/dnorm(x),from=0, to=9)
>From the plot we see that for x between 8.0 and 8.3 the function is
fluctuating.
As far as I understand, this is due to the function pnorm() not being
sufficiently accurate in the tails.
I am using pnorm() in a way that has probably not been
2007 Jun 08
2
pnorm how to decide lower-tail true or false
Hi to all,
maybe the last question was not clear enough.
I did not found any hints how to decide whether it should use lower.tail
or not.
As it is an extra R-feature ( written in
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66250.html )
I do not find anything about it in any statistical books of me.
Regards Carmen
2010 May 13
1
results of pnorm as either NaN or Inf
I stumbled across this and I am wondering if this is unexpected behavior
or if I am missing something.
> pnorm(-1.0e+307, log.p=TRUE)
[1] -Inf
> pnorm(-1.0e+308, log.p=TRUE)
[1] NaN
Warning message:
In pnorm(q, mean, sd, lower.tail, log.p) : NaNs produced
> pnorm(-1.0e+309, log.p=TRUE)
[1] -Inf
I don't know C and am not that skilled with R, so it would be hard for me
to look into
2004 Aug 06
3
Bug in qnorm or pnorm?
I found the following strange behavior using qnorm() and pnorm():
> x<-8.21;x-qnorm(pnorm(x))
[1] 0.0004638484
> x<-8.22;x-qnorm(pnorm(x))
[1] 0.01046385
> x<-8.23;x-qnorm(pnorm(x))
[1] 0.02046385
> x<-8.24;x-qnorm(pnorm(x))
[1] 0.03046385
> x<-8.25;x-qnorm(pnorm(x))
[1] 0.04046385
> x<-8.26;x-qnorm(pnorm(x))
[1] 0.05046385
> x<-8.27;x-qnorm(pnorm(x))
2008 Feb 07
5
pnorm
Dear R list,
I calculated a two-sided p values according to 2*(1-pnorm(8.104474)), which gives 4.440892e-16. However, it appears to be 5.30E-16 by a colleague and 5.2974E-16 from SAS. I tried to get around with mvtnorm package but it turns out to be using pnorm for univariate case. I should have missed some earlier discussions, but for the moment is there any short answer for a higher
2009 Jul 17
2
how to evaluate character vector within pnorm()
Hi,
I'm trying to evaluate a character vector within pnorm. I have a vector
with values and names
x = c(2,3)
names(x) = c("mean", "sd")
so that i tried the following
temp = paste(names(x), x, sep = "=")
#gives
#> temp
#[1] "mean=2" "sd=3"
#Problem is that both values 2 and 3 are taken as values for the mean
argument in pnorm
pnorm(0,
2005 Aug 30
2
about "pnorm"
As to the function"pnorm",the default degree of freedom(df) is infinite.
I wanna know how to set the df as I want.
Help on pnorm doesn't have df setting.The only choice are:"mean, sd, lower.tail, log.p",but no df.
For instance:
sample size=6
df=6-1=5
t value=9.143
I wanna to the corresponding p value by using function "pnorm".
How can I do it?
Thanks a lot
2008 Mar 06
3
1-pnorm values in a table
Hi,
I've read in a csv file (test.csv) which gives me the following table:
Hin1 Hin2 Hin3 Hin4 Hin5 Hin6
HAI1 9534.83 4001.74 157.16 3736.93 484.60 59.25
HAI2 13272.48 1519.88 36.35 33.64 46.68 82.11
HAI3 12587.71 5686.94 656.62 572.29 351.60 136.91
HAI4 15240.81 10031.57 426.73 275.29 561.30 302.38
HAI5 15878.32 10517.14 18.93 22.00 16.91
2009 Dec 08
4
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)
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 = TRUE)
> ifelse(Resp, log(pnorm(Xb)), log(1 - pnorm(Xb)))
[1] -0.6931472 -1.8410216
2000 Oct 20
1
bug in pnorm (PR#699)
Full_Name: James Michael Rath
Version: all (I think)
OS: doesn't matter
Submission from: (NULL) (129.116.226.162)
The code for pnorm in R was adapted from a Fortran library published in the ACM
TOMS journal. The published version had a typographical error, though, which
was
pointed out in a second article published three years after the original.
The error was that a macro/variable named
2000 Jun 19
1
missing include in pnorm.c (PR#575)
Full_Name: Julian Faraway
Version: R-Release (June 15)
OS: Linux (redhat)
Submission from: (NULL) (141.211.66.172)
R fails to compile on the current released version. Some constants
are undefined in pnorm.c. It appears that adding
#include "nmath.h"
to pnorm.c solves this problem.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list
2011 Apr 06
3
Decimal Accuracy Loss?
This is hopefully a quick question on decimal accuracy. Is any
decimal accuracy lost when casting a numeric vector as a matrix? And
then again casting the result back to a numeric?
I'm finding that my calculation values are different when I run for
loops that manually calculate matrix multiplication as compared to
when I cast the vectors as matrices and multiply them using "%*%".
2003 Apr 30
1
pnorm conditional (PR#2883)
--=-YFjXKq8/D/t1qWmIzQ9D
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
I was going over the source in src/nmath/pnorm.c and noticed a little
bug in pnorm_both (in R 1.7.0). The else-if on line 205 covers the
entire real line. Seems you want an &&, not an ||. Doesn't make a big
difference (you still get a 0 or 1 from extreme starting values) but
your log
2006 Feb 10
3
Accuracy of dnorm (PR#8586)
Full_Name: Marco Vezzoli
Version: 2.2.0 2.1.0 2.0.0
OS: Solaris, Windows, Linux
Submission from: (NULL) (57.78.11.38)
The dnorm functions yield a wrong value when the standard deviation is near to
1e-1
e.g.
> dnorm(0,mean=0.04,sd=0.3)
[1] 1.318039
this error is consistent in various version and os.
2011 Nov 23
2
How to increase precision to handle very low P-values
Hello, Rlisters
I have to compute p-values that are on the tail of the distribution,
P-values < 10^-20.
However, my current implementations enable one to estimate P-values up to
10^-12, or so.
A typical example is found below, where t is my critical value.
########### example - code adapted from Rassoc #######################
rho01 = 0.5
rho105 = 0.5
rho005 = 0.5
t = 8
z = 2
2004 Aug 13
0
pnorm, qnorm
Trenkler, Dietrich said:
>
> I found the following strange behavior using qnorm() and pnorm():
>
> > x<-8.21;x-qnorm(pnorm(x))
> [1] 0.0004638484
> > x<-8.28;x-qnorm(pnorm(x))
> [1] 0.07046385
> > x<-8.29;x-qnorm(pnorm(x))
> [1] 0.08046385
> > x<-8.30;x-qnorm(pnorm(x))
> [1] -Inf
>
qnorm(1-.Machine$double.eps)
[1] 8.12589
2004 May 05
4
Discontinuities in a simple graph (machine precision?)
Hi,
I've got an ugly but fairly simple function:
mdevstdev <- function(a){
l <- dnorm(a)/(1-pnorm(a))
integrand <- function(z)(abs(z-l)*dnorm(z))
inted <- integrate(integrand, a, Inf)
inted[[1]]/((1- pnorm(a))*sqrt((1 + a*l - l^2)))
}
I wanted to quickly produce a graph of this over the range [-3,3] so I
used:
plotit <-function(x=seq(-3,3,0.01),...){
2011 Feb 21
1
question about solving equation using bisection method
Hi all,
I have the following two function f1 and f2.
f1 <- function(lambda,z,p1){
lambda*(p1*exp(-3*z-9/2)+(0.2-p1)*exp(4*z-8))-(1-lambda)*0.8}
f2 <- function(p1,cl, cu){
0.8*(pnorm(cl)+(1-pnorm(cu)))/(0.8*(pnorm(cl)+(1-pnorm(cu)))+p1*(pnorm(cl+3)+(1-pnorm(cu+3)))+(0.2-p1)*(pnorm(cl-4)+(1-pnorm(cu-4))))}-0.05
First fix p1 to be 0.15.
(i) choose a lambda value, say lamda=0.6,
(ii)
2006 Nov 25
3
OT: P(Z <= -1.46).
In checking over the solutions to some homework that I had assigned I
observed the fact that in R (version 2.4.0) pnorm(-1.46) gives
0.07214504. The tables in the text book that I am using for the
course give the probability as 0.0722.
Fascinated, I scanned through 5 or 6 other text books (amongst the
dozens of freebies from publishers that lurk on my shelf) and found
that some agree with R
2004 Jun 16
2
erf function documentation
Hi all. I may be wrong, (and often am), but in trying
to determine how to calculate the erf function, the
documentation for 'pnorm' states:
## if you want the so-called 'error function'
erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1
## and the so-called 'complementary error function'
erfc <- function(x) 2 * pnorm(x * sqrt(2),
lower=FALSE)
Should, instead, it read: