similar to: Pseudo-random numbers between two numbers

Displaying 20 results from an estimated 6000 matches similar to: "Pseudo-random numbers between two numbers"

2010 Jul 12
3
How to mean, min lists and numbers
I would like to sum/mean/min a list of lists and numbers to return the related lists. -1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but sum(1,2*c(1,1,0),2,c(-1,10,-1)) returns 15 not a list. Using the suggestions of Gabor Grothendieck, Reduce('+',list(-1,2*c(1,1,0),2,c(-1,10,-1))) returns what we want, c(2,13,0). However, it seems that this way does not work to mean/min. So, how to
2010 Jun 02
4
Draw text with a box surround in plot.
text() can draw text on a plot. Do we have a way/function to draw text with a box surround it? Thanks, -james
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))
2010 Jul 07
2
Sum vectors and numbers
We want to sum many vectors and numbers together as a vector if there is at least one vector in the arguments. For example, 1 + c(2,3) = c(3,4). Since we are not sure arguments to sum, we are using sum function: sum(v1,v2,...,n1,n2,..). The problem is that sum returns the sum of all the values present in its arguments: sum(1,c(2,3))=6 sum(1,2,3)=6 We do not want to turn sum(v1,v2,...,n1,n2,..) to
2009 Sep 09
3
How to return/show the indexes of unusual points in boxplot?
I am wondering if you know how to return by function or show in boxplot, the indexes of unusual points, such as, points that are outside the box or in [Q3+1.5IQR,Max]. For example, > boxplot(c(4,rnorm(20),8)) There are 2 unusual points 4 and 8. How to show the indexes of 4 and 8 in the boxplot or return them by function? Thanks, -james
2011 Sep 03
3
question with uniroot function
Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion "Fp2" which is defined as below. Fz <- function(z){0.8*pnorm(z)+p1*pnorm(z-u1)+(0.2-p1)*pnorm(z-u2)} Fp <- function(t){(1-Fz(abs(qnorm(1-(t/2)))))+(Fz(-abs(qnorm(1-(t/2)))))} Fp2 <- function(t) {Fp(t)-0.8*t/alpha} th <- uniroot(Fp2, lower =0, upper =1,
2012 Jun 18
3
(1-1e-100)==1 true?
Hi, This problems has bothered me for the lase couple of hours. > 1e-100==0 [1] FALSE > (1-1e-100)==1 [1] TRUE How can I tell R that 1-1e-100 does not equal to 1, actually, I found out that > (1-1e-16)==1 [1] FALSE > (1-1e-17)==1 [1] TRUE The reason I care about this is that I was try to use qnorm() in my code, for example, > qnorm(1e-100) [1] -21.27345 and if I want to
2001 Jul 02
2
Shapiro-Wilk test
Hi, does the shapiro wilk test in R-1.3.0 work correctly? Maybe it does, but can anybody tell me why the following sample doesn't give "W = 1" and "p-value = 1": R> x<-1:9/10;x [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 R> shapiro.test(qnorm(x)) Shapiro-Wilk normality test data: qnorm(x) W = 0.9925, p-value = 0.9986 I can't imagine a sample being
2019 Jun 21
4
Calculation of e^{z^2/2} for a normal deviate z
You may want to look into using the log option to qnorm e.g., in round figures: > log(1e-300) [1] -690.7755 > qnorm(-691, log=TRUE) [1] -37.05315 > exp(37^2/2) [1] 1.881797e+297 > exp(-37^2/2) [1] 5.314068e-298 Notice that floating point representation cuts out at 1e+/-308 or so. If you want to go outside that range, you may need explicit manipulation of the log values. qnorm()
2010 Oct 03
2
sampling from normal distribution
Hello If i want to resampl from the tails of normal distribution , are these commans equivelant??   upper tail:qnorm(runif(n,pnorm(b),1))  if b is an upper tail boundary   or   upper tail:qnorm((1-p)+p(runif(n))  if p is the probability of each interval (the observatins are divided to intervals)   Regards [[alternative HTML version deleted]]
2009 Mar 10
2
How to color certain area under curve
For a given random variable rv, for instance, rv = rnorm(1000), I plot its density curve and calculate some quantiles: plot(density(rv)) P10P50P90 = = quantile(rv,probs = c(10,50,90)/100) I would like to color the area between P10 and P90 and under the curve and mark the P50 on the curve. > rv = rnorm(1000) > plot(density(rv)) > P10P50P90 = = quantile(rv,probs = c(10,50,90)/100) Could
2010 May 27
2
How to catch Error Messages in R
As we knew, if a function is not used correctly, an error message will throw/display in R: > rnorm(-1) Error in rnorm(-1) : invalid arguments I would like to catch the error message or assign an error message to a variable so that I can use them some where else. So, how to catch error messages in R? Thanks, -james
2009 May 20
2
How to load data from Statistics Canada
We would like to load data from Statistics Canada (http://www.statcan.gc.ca/) using R, for example, Employment and unemployment rates. It seems to me that the tables are displayed in HTML. I was wondering if you know how to load these tables. Thanks, -james
2008 Apr 13
4
R equivalent of erfcinv in matlab
I am converting some matlab code into R that use inverse of the complementary error function, erfcinv and did not find an equivalent in R, is there such a function in some contributed modules? Thanks.
2006 Oct 27
3
Power of test
What would be the R formulae for a two-sided test? I have a formula for a one-sided test: powertest <- function(a,m0,m1,n,s){ t1 = -qnorm(1-a) num = abs(m0-m1) * sqrt(n) t2 = num/s pow = pnorm(t1 + t2) } Would you pls let me know if you know of? Thank you, ej
2003 Mar 31
2
point-biserial correlation
Dear list, has anyone written a package/function in R for computing a point- biserial resp. biserial correlation? Thanks in advance Bernd
2009 May 27
2
How to set a filter during reading tables
We are reading big tables, such as, Chemicals <- read.table('ftp://ftp.bls.gov/pub/time.series/wp/wp.data.7.Chemicals',header = TRUE, sep = '\t', as.is =T) I was wondering if it is possible to set a filter during loading so that we just load what we want not the whole table each time. Thanks, -james
2006 Jan 31
1
approximation to ln \Phi(x)
I am using pnorm() with the log.p=T argument to get approximations to ln \Phi(x) and qnorm with the log.p=T argument to get estimates of \Phi^{-1}(exp(x)). What approximations are used in these two functions (I noticed in the source pnorm.c it doesn't look like Abramowitz and Stegen) and where can I find the citation? Thanks, Richard Morey
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very small p-values (although the example below may win some kind of a prize: I've seen people talking about p-values of the order of 10^(-2000), but never 10^(-(10^8)) !). That said, there are a several tricks for getting more reasonable sums of very small probabilities. The first is to scale the p-values by dividing the
2010 Nov 12
4
dnorm and qnorm
Hello all, I have a question about basic statistics. Given a PDF value of 0.328161, how can I find out the value of -0.625 in R? It is like reversing the dnorm function but I do not know how to do it in R. > pdf.xb <- dnorm(-0.625) > pdf.xb [1] 0.328161 > qnorm(pdf.xb) [1] -0.444997 > pnorm(pdf.xb) [1] 0.628605 Many thanks, Edwin -- View this message in context: