Displaying 20 results from an estimated 11000 matches similar to: "Display a very low p-value"
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
2003 Oct 14
3
Number Format
Hi
A very simple question on number formats. After some calculations, some variables I have come out looking like this:
-1.892972e+00
Now apart from the fact that the "e+00" is completely redundant, I would rather have the number represented without the e bit. I want to export data like this to a text file and would rather have:
-1.892972
than
-1.892972e+00
I have tried
2007 Jun 06
6
p-value from GEE
Hi to all,
I found in the R-help archive how to calculate the p-value for a gee result:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/74150.html
but there are two questions (I am afraid they are basic questions ...)
1. why is the result multiplicated with 2
2. how could I decide between lower.tail =TRUE and FALSE:
example:
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))
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
2006 Mar 06
1
P-values from survreg (survival package) using a clusterterm
Hi all.
Belove is the example from the cluster-help page wtih the output.
I simply cannot figure out how to relate the estimate and robust Std. Err to
the p-value. I am aware this a marginal model applying the sandwich
estimator using (here I guess) an emperical (unstructered/exchangeable?)
ICC. Shouldent it be, at least to some extend, comparable to the robust
z-test, for rx :
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,
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:
2011 Sep 11
3
(no subject)
Dear all,
Can anyone take a look at my program below?
There are two functions: f1 (lambda,z,p1) and f2(p1,cl, cu).
I fixed p1=0.15 for both functions. For any fixed value of lambda (between
0.01 and 0.99),
I solve f1(p1=0.15, lambda=lambda, z)=0 for the corresponding cl and cu
values.
Then I plug the calculated cl and cu back into the function f2.
Eventually, I want to find the lambda value
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
2009 Feb 12
1
Optim
Dear R user I follow the steps defined in Modern applied statistics page(453)
to use optim. However, when I run the following code the parameters seems
way off and the third parameter(p3) stayed as the initial value.
below is the code:
## data
da=c(418,401,416,360,411,425,537,379,484,388,486,380,394,363,405,383,392,363,398,526)
### initial values
pars=c(392.25, 507.25, 0.80)
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
2012 Feb 02
1
Calculate the natural log of cdf between 2 intervals
Hello all,
I was wondering if there is an R function to do the following:
[*] log(pnorm(x)-pnorm(y)), where x>y.
I don't want all the area under the natural log of the normal pdf less than
x, I only want the area between y and x.
I am aware of the ability to specify log.p=TRUE, which gives me the log of
the probability that X<=x. This does not help me, because the following
code:
2006 Dec 15
2
ks.test "greater" and "less"
Hello r-group
I have a question to the ks.test.
I would expect different values for less and greater between data1 and
data2.
Does anybody could explain my point of misunderstanding the function?
data1<-c(8,12,43,70)
data2<- c(70,43,12,8)
ks.test(data1,"pnorm")
ks.test(data1,"pnorm",alternative ="less") #expected < 0.001
2006 Jul 02
1
workaround for numeric problems
Dear R-people,
I have to compute
C - -(pnorm(B)*dnorm(B)*B + dnorm(B)^2)/pnorm(B)^2
This expression seems to be converging to -1 if B approaches to -Inf
(although I am unable to prove it). R has no problems until B equals
around -28 or less, where both numerator and denominator go to 0 and
you get NaN. A simple workaround I did was
C <- ifelse(B > -25,
-(pnorm(B)*dnorm(B)*B
2007 Sep 13
2
Reciprocal Mill's Ratio
I believe that this may be more appropriate here in r-devel than in r-help.
The normal hazard function, or reciprocal Mill's Ratio, may be obtained
in R as dnorm(z)/(1 - pnorm(z)) or, better, as dnorm(z)/pnorm(-z) for
small values of z. The latter formula breaks dowm numerically for me
(running R 2.4.1 under Windows XP 5.1 SP 2) for values of z near 37.4
or greater.
Looking at the pnorm
2010 Jun 13
2
help with R
Hi all,
I want to solve the following equation for x with rho <- 0.5
pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05
Is there a function in R to do this?
Thank you very much!
Hannah
[[alternative HTML version deleted]]
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
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