search for: rexp

Displaying 20 results from an estimated 283 matches for "rexp".

Did you mean: resp
2006 Feb 03
2
Problems with ks.test
Hi everybody, while performing ks.test for a standard exponential distribution on samples of dimension 2500, generated everytime as new, i had this strange behaviour: >data<-rexp(2500,0.4) >ks.test(data,"pexp",0.4) One-sample Kolmogorov-Smirnov test data: data D = 0.0147, p-value = 0.6549 alternative hypothesis: two.sided >data<-rexp(2500,0.4) >ks.test(data,"pexp",0.4) One-sample Kolmogorov-Smirnov test data: data D = 0.019, p-value...
2012 Jan 27
3
generate a random number with rexp ?
dear list I use runif to generate a ramdom number between min and max runif(n, min=0, max=1) however , the syntaxe of rexp does not allow that rexp(n, rate = 1) and it generate a number with the corresponding rate. The question is: how to generate a number between min and max using rexp(). Regards -- PhD candidate in Computer Science Address 3 avenue lamine, cité ezzahra, Sousse 4000 Tunisia tel: +216 97 246 70...
1999 Aug 30
1
rexp and rweibull
In splus rexp() and rweibull() are related: > set.seed(153) > rexp(1) [1] 0.0493267 > set.seed(153) > rweibull(1, shape=1) [1] 0.0493267 (you can also try shape =2, then rweibull = sqrt(rexp) ) However, in rw0.64.1 (on Win NT) they are different > .Random.seed <- 1:4 > rexp(1) [1] 1.4120...
2006 Aug 15
1
rexp question
I am using rexp to generate several exponential distributions. I am passing rexp a vector of rates , r. I am wanting to simulate a sample of size 200 for each rate so the code looks like: rexp(n=200*length(r),rate=r) this gives me a vector of the random exponential variables, but they are all disjointed b/c rexp g...
2002 May 03
6
problems with rexp ?
Does anyone know if R have any problems with the exponential random number generation (function rexp)? I comment it because I executed data<-sort(rexp(100)) plot(data,dexp(data)/(1-pexp(data)),type="l") and the graphic isn't constant. (Note: exponential distribution have a constant hazard failure rate). Thank you, Juan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-...
2006 Jul 19
1
ASCII dump from an REXP (JRI)
.... Is there a way to just print, verbatim, what R evaluates to the screen (ie just a pure ASCII dump with no regard to the data type)? (I?m using Windows XP SP2, 2 x 1.8Ghz Xeon, 1GB RAM, Eclipse 3.1.1, JRI 0.2, R 2.2.1, jdk1.5.0_07, jre1.5.0_06) You mentioned earlier doing something as follows: rexp=reng.eval("nucleitrain"); System.out.println("nucleitrain="+rexp); long[] l=reng.rniGetVector(rexp.xp); for (int i=0;i<l.length;i++) System.out.println(new REXP(reng, l[i])); Now, Java outputs to the screen this: nucleitrain=RXP[unknown/19, id=1218430184, o=null] RX...
2017 Oct 27
2
How to do a "Box's M" Test with
Trying to get past a frustrating error to do a "simple" Box's M test using Java. The Box's M test says it will work with a data.frame. Here's the setup code: REXP myDf = REXP.createDataFrame(new RList( new REXP[] { new REXPDouble(d1), new REXPDouble(d2), new REXPDouble(d3), new REXPDouble(d4), new REXPInteger(d5) })); Here's the call: REXP boxMResult = rConnection.eval( "boxM(" + myDf+ "[,-5], " + myDf + " [, 5])"); But,...
2014 Jan 17
1
rexp, different results on 32/64 bit
Hi all, I just run into this today. Apparently rexp() sometimes gives different slightly results for the same seed on 32 bit and 64 bit machines. runif() is the same for both, so the problem seems to be in rexp(). 64 bit Linux is the same as 64 bit OSX, and R-devel gives the same results as R-3.0.2. Best, Gabor # ---------------------------------...
2008 May 23
1
Evaluation "conflict" in combination of replicate() and rexp()as variable inside a function
...side a self-defined "wrapper" function I encounterd a puzzling behaviour. The following are intentionally simple (and rather nonsense-) examples to isolate the relevant aspects. Please, note the seemingly "inconsistent" behaviour for the second call of rdistr() (with distr = rexp) for which I have not found any explanation (yet): > rdistr <- function( distr, ...) replicate( 1, distr( n = 1, ...)) > rdistr( distr = rnorm) [1] -0.8889223 > rdistr( distr = rexp) [1] NaN Warning message: In distr(n = 1, ...) : NAs produced > rdistr( distr = runif) [1] 0.8444...
2011 Aug 17
3
How to apply a function to subsets of a data frame *and* obtain a data frame again?
Dear all, First, let's create some data to play around: set.seed(1) (df <- data.frame(Group=rep(c("Group1","Group2","Group3"), each=10), Value=c(rexp(10, 1), rexp(10, 4), rexp(10, 10)))[sample(1:30,30),]) ## Now we need the empirical distribution function: edf <- function(x) ecdf(x)(x) # empirical distribution function evaluated at x ## The big question is how one can apply the empirical distribution function to ## each subset of df determ...
2009 Sep 20
1
Return a list from a .Call but segfaults
...th browser(), and type head(ll) i get valid results. However, i get a segfault when the code runs the next line j <- append(j,ll) (where j was defined as vector(mode='list') ) The code below looks alright, but it appears to crash when getting copied. Now one could blame message2rexp (in kk_), but once in R, the result of .Call is assigned to ll, everything should be protected. In fact, if in kk_ i simply return a VECSXP with 2 elements, no errors, so one could conclude that message2rexp is to blame. Yet, when i replace the code with R code, that is using readBin and onl...
2009 Mar 19
4
Import R-output into Java
...import R-output via Rserve to Java, especially for the function ctree from the package party. Rserve is working properly. Yet, I only get the predictions with the Java code try{ RConnection c = new RConnection(); ... c.voidEval("modell <- ctree(...)"); REXP y = c.eval("nodes(modell,1)[[1]]$prediction"); ... }catch(Exception e){} When I try to get the whole text with REXP z = c.eval("nodes(modell,1)[[1]]"); System.out.println(z); I get something like org.rosuda.REngine.REXPGenericVector at 119c082+[10]named Bu...
2008 Feb 29
1
patch for random.c
...anise some code, I studied the code of random.c and noticed that for distributions with 2 or 3 parameters the user is not warned if NAs are created while such a warning is issued for distributions with 1 parameter. E.g: R version 2.7.0 Under development (unstable) (2008-02-29 r44639) [...] > rexp(2, rate=Inf) [1] NaN NaN Warning message: In rexp(2, rate = Inf) : NAs produced > rnorm(2, mean=Inf) [1] NaN NaN Surprisingly, the code for issuing warnings for distributions with 2 or 3 parameters is essentially there, but does not seem to be used. The attached patch rectifies this. With the...
2012 Jun 30
2
incorrect number of subscripts on matrix
Hi, Wondering if anyone could help me out with this error.Im trying to fill a matrix with random numbers taken from an exponential distribution using a loop: x.3<-matrix(rep(0,3000),nrow=1000,byrow=T)for(i in 1:1000){x[i,]<-rexp(3,rate=2/3)} I get the error message: Error in x[i, ] <- rexp(3, rate = 2/3) : incorrect number of subscripts on matrix Any ideas??? Appreciate any thoughts. [[alternative HTML version deleted]]
2015 Apr 09
2
[LLVMdev] BNF for IL/IR interpreter
...BNF terms and actions on them. Like, say I convert push ebp to Bap IL (here's a json representation from their live development branch): { "move": { "lvar": { "name": "t", "id": 107, "typ": { "imm": 64 } }, "rexp": { "var": { "name": "RBP", "id": 30, "typ": { "imm": 64 } } } } }, { "move": { "lvar": { "name": "RSP", "id": 32, "typ": { "imm": 64 } }, "rexp&qu...
2007 May 17
2
controling the size of vectors in a matrix
hie R users l have the following matrix n=20 m<-matrix(nrow=n,ncol=4) colnames(m)=c("treatmentgrp","strata","survivalTime") for(i in 1:n) m[i,]<-c(sample(c(1,2),1,replace=TRUE),sample(c(1:2),1,replace=TRUE),rexp(1,0.07),rexp(1,0.02)) print(m) 1.l would like to control the size of the treatment variable eg treatment 1=size 5 treatment 2=size 15. 2. l would also want to control the size of the strata ie in treatment 1 divide...
2011 Jun 14
1
About 'hazard ratio', urgent~~~
Hi, I am new to R. My question is: how to get the 'hazard ratio' using the 'coxph' function in 'survival' package? thanks, karena -- View this message in context: http://r.789695.n4.nabble.com/About-hazard-ratio-urgent-tp3595527p3595527.html Sent from the R help mailing list archive at Nabble.com.
2017 Oct 27
4
Cannot Compute Box's M (Three Days Trying...)
...n" + "6.5,3,5.2,2,virginica\n" + "6.2,3.4,5.4,2.3,virginica\n" + "5.9,3,5.1,1.8,virginica\n"; List tableRead = rConnection.eval( "read.csv(textConnection(\"" + inputIris + "\"), header = FALSE)").asList(); // works! double[] d1 = ((REXPVector) ((RList) tableRead).get(0)).asDoubles(); double[] d2 = ((REXPVector) ((RList) tableRead).get(1)).asDoubles(); double[] d3 = ((REXPVector) ((RList) tableRead).get(2)).asDoubles(); double[] d4 = ((REXPVector) ((RList) tableRead).get(3)).asDoubles(); String[] d5 = ((REXPVector) ((RList) tableRe...
2007 Apr 26
3
adding a column to a matrix
...go about it thanks the code l used to generate the data is n=100 > m=matrix(nrow=n,ncol=4) > colnames(m)=c("treat", "strata", "censti", "survTime") > for(i in 1:100) m[i,]=c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,.002),rexp(1,.005)) > m l know its ugly but it seems to work any suggestions l still new at this thanks --------------------------------- [[alternative HTML version deleted]]
2007 Apr 25
2
creating random numbers
...2 0 1 1 2 1 2 0 2 1 2 0 1 0 these should be created randomly secondly if l have something like for (i in 1:n ) df =c(1,rexp(1,.001),rexp(1,.002)) can l add an if statement in side the c maybe to compare the 2 exponential numbers to create another variable --------------------------------- [[alternative HTML version deleted]]