similar to: Random number

Displaying 20 results from an estimated 40000 matches similar to: "Random number"

2009 Oct 10
1
Creating new variables
Hi all, I have a data set called x with 200 rows and 12 columns. I want create two more columns based on probability. ie if p >0 .4 then v1 =1 else v1=0; if p >0 .6 then v2 =1 else v2=0; Finally x will have 14 variables. Can any one show me how to do that? Thanks Ashta . [[alternative HTML version deleted]]
2013 Feb 09
1
R maps Help
I am fairly new to R and am plotting flight data on a map. Everything is working well except the size of the map is really too small to show the data effectively and I can't seem to figure out how to make the output map larger. Do I need to change the device characteristics or is it a map.??? call. Here is the code: library(maps) library(geosphere) airports <-
2007 Jun 18
4
triangle contour plots
Suppose I have three numbers p1, p2, p3 with 0 <= p1,p2,p3 <= 1 and p1+p2+p3=1, and a function f=f(p1,p2,p3) = f(p1,p2,1-p1-p2). How to draw a contour plot of f() on the p1+p2+p3=1 plane, that is, an equilateral triangle? Functions triplot(), triangle.plot(), and ternaryplot() give only scatterplots, AFAICS -- Robin Hankin Uncertainty Analyst National Oceanography Centre,
2011 Nov 03
2
optimising a loop
Dear R community, I'm trying to remove a loop from my code but I'm stock and I can't find a good way to do it. Hopefully one of you will have something clever to propose. Here is a simplified example: I have a squared matrix: > nom.plac2 <- c("102", "103", "301", "303","304", "403") > poids2 <- matrix(NA, 6,6,
2011 Mar 29
4
Creating 3 vectors that sum to 1
I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these and I've thought about using scatterplot3d(). Here's what I have so far. library(scatterplot3d) p1 <- c(1,0,0,.5,.5,0,.5,.25,.25,.34,.33,.33,.8,.1,.1,.9,.05,.05) p2 <- c(0,1,0,.5,0,.5,.25,.5,.25,.33,.34,.33,.1,.8,.1,.05,.9,.05) p3 <-
2012 Sep 26
3
replace string values with numbers
Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 CG CG GG -- -- AC -- AC CC AC -- AC I tried to replace all the GG with a value 3. Gene[Gene=="GG"]<-3 It always give me: Warning in `[<-.factor`(`*tmp*`, thisvar, value = 3) : invalid factor level, NAs generated Does any know if there is anything wrong with my code? Thanks, Zhengyu
2009 Nov 08
5
look up and Missing
HI R-Users Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.). v1 v2 v3 v4 v5 1 2 3 3 6 5 2 4 2 0 2 -9 5 4 3 6 2 1 3 4 1, I want to look at the entire row values of when v2 =-9 like 2 -9 5 4 3 I wrote K<- list(if(temp$v2)==-9)) I wrote the like this but it gave me which is not correct.
2012 Oct 22
5
Help plz to fix it
I have an array of probabilities....it is p. So if user types x=1 then probability is p1=1/10. If user types x=2 it means that p2= p1+p2 if user types x=3 it means that p3=p1+p2+p3....and so on. So i created a code..... but it doesnt work properly. Help me plz to fix it) Thank u in advance. psidp=function(x){ p<-(1/10 2/5 2/5 2/5 2/5 1/10 1/10 1/10 1/10 1/10) i==0; if (x!=0){ for
2007 Jul 03
3
generating correlated Bernoulli random variables
Hi all, I was wondering how to generate samples for two RVs X1 and X2. X1 ~ Bernoulli (p1) X2 ~ Bernoulli (p2) Also, X1 and X2 are correlated with correlation \rho. Regards, Vineet [[alternative HTML version deleted]]
2011 Jan 13
1
setting up a genoud run
Hello - and sorry for a possibly stupid question, I'm just starting to learn rgenoud. I am defining a function with 5 parameters (p1, p2, p3, p4a, and p4b) and then want to optimize it using genoud. But I am doing something wrong. Before genoud is even able to run it says: "Error in p2 + 1.2 : 'p2' is missing". I assume I did not specify it right. My code is below. The task
2010 May 06
4
sample size for survival curves
Dear R users, I am not asking questions specifically on R, but I know there are many statistical experts here in the R community, so here it goes my questions: Freedman (1982) propose an approximation of sample size/power calculation based on log-rank test using the formula below (This is what nQuery does): (Z(1-?/side)+Z(power))^2*(hazard.ratio+1)^2 N =
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
I'm solving 4 complex equations simultaneously. Code is below. The code returns only zero's for the solution though there should also be a non-zero result. I'm pretty confident that the equations are correct because they are straight from a published paper and I checked them pretty thoroughly. The parameter values I used are from the published paper as well. Any suggestions for how
2005 May 19
5
Arranging Plots
Dear all, I'd appreciate any hints how to arrange some plots. I have three plots. I would like to arrange them in the following order: - Plot 1 and Plot 2 should be in the upper row - Plot 3 should be in the lower row but centered in the middle. I hope the following sketch will help understanding my problem ================ | === === | || P1| |P2 | | || | | | | | === === |
2010 Sep 25
1
margin control in lattice package
Hi all, I am difficulty with simple layout of plots in the lattice package I have created a series of levelplots and would like to plot them to a single device, but need to reduce the margin areas. This is easily accomplished with par(oma) and par(mar) in the base graphics package but I am having problems finding the equivalent features in the lattice package. Ideally, I would like to reduce
2002 Mar 25
2
Extreme value distributions (Long.)
This may not actually be an R/Splus problem, but it started off that way ..... ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== Executive summary: ================== Simulations involving extreme value distributions seem to ``work'' when the underlying distribution is exponential(1) or exponential(2) == chi-squared_2, but NOT when the underlying distribution is
2019 Jan 14
2
Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
On Mon, Jan 14, 2019 at 9:36 AM Chandler Carruth via llvm-dev < llvm-dev at lists.llvm.org> wrote: > While I'm very interested in the end result here, I have some questions > that don't seem well answered yet around pointer subtraction... > > First and foremost - how do you address correctness issues here? Because > the subtraction `A - B` can escape/capture more
2012 Sep 20
3
Problem with Newton_Raphson
Hello, I have being trying to estimate the parameters of the?generalized?exponential distribution. The random number generation for the GE distribution is?x<-(-log(1-U^(1/p1))/b), where U stands for uniform dist. The data i have generated to estimate the parameters is right censored and the code is given below; The problem is that, the newton-Raphson approach isnt working and i do not know what
2009 Sep 26
1
multiple lattice, xyplot & levelplot on same page
Dear R-users, I'd like to place an xyplot() at the top of a page and a levelplot() at the bottom of the same page, and have the x-axes be the same. I've come close to finding a solution through Rarchive, and can produce an upside-down version of what I'd like (levelplot() on the top - see code below). However, the following error occurs when I try and plot the xyplot() at the top:
2019 Jan 15
2
Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
On Mon, Jan 14, 2019 at 4:51 PM Chandler Carruth <chandlerc at gmail.com> wrote: > > On Mon, Jan 14, 2019, 15:59 Mehdi AMINI <joker.eph at gmail.com wrote: > >> >> >> On Mon, Jan 14, 2019 at 9:36 AM Chandler Carruth via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> While I'm very interested in the end result here, I have
2011 Aug 13
1
Own R function doubt
Hi to all the people again, I was writting a simply function in R, and wish to collect the results in a excel file. The work goes as follows, Ciervos<-function(K1, K0, A, R,M,Pi,Hembras) {B<-(K1-K0)/A T1<-(R*Pi*Hembras-M*Pi+B)/(Pi-M*Pi+R*Pi*Hembras) P1<-Pi-B R1<-P1*Hembras*R M1<-P1*M T2<-(R1-M1+B)/(P1-M1+R1) P2<-P1-B R2<-P2*Hembras*R M2<-P2*M