search for: rnorm

Displaying 20 results from an estimated 7078 matches for "rnorm".

2009 Aug 24
1
how to add 95% confidential interval as vertical lines to x axe in density plot
...n do this work, but I do not know how to handle functions of this library when I used ggplot2 to draw the graph. Thank you in advance. The data and codes followed: # dummy data factor<-rep(c("Alice","Jone","Mike"),each=100) factor<-factor(factor) traits1<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits2<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits3<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits4<-c(rnorm(100, mean=1, sd=1), rno...
2009 Aug 21
0
how to plot 95% confidential interval as vertical lines to x axe in density plot
...n do this work, but I do not know how to handle functions of this library when I used ggplot2 to draw the graph. Thank you in advance. The data and codes followed: # dummy data factor<-rep(c("Alice","Jone","Mike"),each=100) factor<-factor(factor) traits1<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits2<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits3<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3), rnorm(100, mean=6, sd=6)) traits4<-c(rnorm(100, mean=1, sd=1), rno...
2004 Feb 26
2
limit to complex plots?
..., divided into 6 graphs/plots each with an inset sub-figure. I can use to layout command to generate one figure with one inset sub-figure, but cannot seem to do it for multiple figures on one page. I've tried a test with the following code: layout(matrix(c(1,2,3,4), nrow=2, byrow=TRUE)) plot(rnorm(10), rnorm(10)) plot(rnorm(10), rnorm(10)) plot(rnorm(30), rnorm(30)) plot(rnotm(40), rnorm(40)) layout.show(4) #this works and gives me my one page with 4 figures on it layout(matrix(c(0,0,0,0,0,1,0,2,0,0,0,0,0,3,0,4), nrow=4, byrow=TRUE)) par(new=TRUE) plot(rnorm(10), rnorm(10)) par(new=TRUE)...
2011 Mar 31
2
Graph many points without hiding some
...raph using a scatterplot. However I find that the first variable gets masked by the other two, so the graph looks entirely different depending on the order of variables. Does anyone have any suggestions how to manage this? This code is an illustration of what I am dealing with: x <- 10000 plot(rnorm(x,mean=20),rnorm(x),col=1,xlim=c(16,24)) points(rnorm(x,mean=21),rnorm(x),col=2) points(rnorm(x,mean=19),rnorm(x),col=3) gives an entirely different looking graph to: x <- 10000 plot(rnorm(x,mean=19),rnorm(x),col=3,xlim=c(16,24)) points(rnorm(x,mean=20),rnorm(x),col=1) points(rnorm(x,mean=21),...
2011 Dec 19
2
Summing x1 to x6
Suppose I have the following: x1<-as.vector(rnorm(10)) x2<-as.vector(rnorm(10)) x3<-as.vector(rnorm(10)) x4<-as.vector(rnorm(10)) x5<-as.vector(rnorm(10)) x6<-as.vector(rnorm(10)) x7<-as.vector(rnorm(10)) x8<-as.vector(rnorm(10)) x9<-as.vector(rnorm(10)) x10<-as.vector(rnorm(10)) I would like the mean of x1 to x6 for ea...
2001 Jun 06
1
lattice (!under development!) font curiosity
Perhaps this might be a font problem, it might be that my font dirs are broken (but I don't think so, it is a standard potato inst.): > xyplot(rnorm(10) ~ rnorm(10) ,main=list("???dsa",cex=2)) ...displays German special characters false (as greek letters). Curiously these work o.k.: > xyplot(rnorm(10) ~ rnorm(10) ,main="?dsa") > xyplot(rnorm(10) ~ rnorm(10) ,main=list("???dsa",cex=1)) > xyplot(rnorm(10)...
2001 Jun 06
1
lattice (!under development!) font curiosity
Perhaps this might be a font problem, it might be that my font dirs are broken (but I don't think so, it is a standard potato inst.): > xyplot(rnorm(10) ~ rnorm(10) ,main=list("???dsa",cex=2)) ...displays German special characters false (as greek letters). Curiously these work o.k.: > xyplot(rnorm(10) ~ rnorm(10) ,main="?dsa") > xyplot(rnorm(10) ~ rnorm(10) ,main=list("???dsa",cex=1)) > xyplot(rnorm(10)...
2008 May 20
2
hist clarification
...ame. According to the help section 'breaks' can be a integer indicating the number of bins. From the example below, the number of bins (length of the counts array) varies. Am I wrong in expecting the same number of bins every time from my hist() call (am I doing something wrong)? > hist(rnorm(1000),breaks=10)$counts; [1] 2 10 18 41 85 151 188 195 149 92 48 14 5 2 > hist(rnorm(1000),breaks=10)$counts; [1] 1 5 19 39 89 155 207 179 162 89 32 19 3 1 > hist(rnorm(1000),breaks=10)$counts; [1] 2 3 19 46 101 149 196 204 137 79 43 16 4 1 > hist...
2010 Jun 26
2
several common sub-axes within multiple plot area
...oal. Can i succeed with something combined with the 'high level' plot() function? Or do i need to get specific with some low level commands (help!)? With big thanks in advance for any suggestions/examples. cheers, Karl #my example: dev.new() plot.new() par(mfrow=c(3,2)) #Graph 1: plot(rnorm(20), rnorm(20), xlab = "Results 1 (Int)", ylab = "Variable A", main = "Factor X") #Graph 2: plot(rnorm(20), rnorm(20), xlab = "Results 1 (Int)", ylab = "Variable A", main = "Factor Y") #Graph 3: plot(rno...
2005 Mar 04
11
R: simulation
hi all a simple question i want to run simulations in r. i however want the experiments to be repeated at a later time with exactly the same numbers by other users. can i set the random number seed for rnorm in some way? e.g. is there some arguement that goes with rnorm? please supply an example regards Allan
2017 Sep 28
3
building random matrices from vectors of random parameters
Suppose I have interest in a matrix with the following symbolic structure (specified by 3 parameters: sa, so, m): matrix(c(0,sa*m,so,sa),2,2,byrow=T) What I can't figure out is how to construct a series of matrices, where the elements/parameters are rnorm values. I'd like to construct separate matrices, with each matrix in the series using the 'next random parameter value'. While the following works (for generating, say, 5 such random matrices) replicate(5,matrix(c(0,rnorm(1,0.8,0.1)*rnorm(1,1.2,0.1),rnorm(1,0.5,0.1),rnorm(1,0.8,0.1)...
2007 Aug 30
2
Assigning line colors in xyplot
Hi, I have a dataframe containing data from individuals 1, ..., 12 (grouping variable "g" in the data frame below), which belong either to "A" or "B" (grouping variable "f"): set.seed(1) tmp <- data.frame( y=c(rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2)), x=1:10, f=c(rep("A",10),rep("B",10),rep("A",10),rep("B",10),rep("A",10),...
2011 Jul 28
2
Animated gif or something similar in R?
...t to a animated gif or some other format that could be used in a powerpoint type presentation? I work with a bunch of 'drama queens'--they'd like it if there was some motion rather than a static display ;-) Thanks in advance, Dale. library(rgl) clusset<-data.frame(x=c(round(abs(rnorm(5,7,1)),1),round(abs(rnorm(5,11,2)),1), round(abs(rnorm(5,16,2)),1),round(abs(rnorm(5,20,1.5)),1),round(abs(rnorm(5,5,2)),1)), y=c(round(abs(rnorm(5,7,2)),1),round(abs(rnorm(5,11,2)),1), round(abs(rnorm(5,16,2)),1),round(abs(...
2012 Mar 16
2
how to speed up the inefficient code
hi, i'm really in trouble to simulate some experiment. that is, it takes too much time to process the following code. following is short example, ------------------------------------------------------------------------------------------------------- p<-data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10),d=rnorm(10)) test<-data.frame(a=rnorm(1),b=rnorm(1),c=rnorm(1),d=rnorm(1)) result<-list() for(i in 1:nrow(p)){ result[[i]]<-sum((p[i,]-test)^2) } result_1<-unlist(result) p_1<-cbind(p,result_1) ----------------------------------------------------------...
2018 Aug 13
1
substitute() on arguments in ellipsis ("dot dot dot")?
...ang-bang ;) library(rlang) dots1 <- function(...) as.list(substitute(list(...)))[-1L] dots2 <- function(...) as.list(substitute(...())) dots3 <- function(...) match.call(expand.dots = FALSE)[["..."]] dots4 <- function(...) exprs(...) bench::mark( dots1(1+2, "a", rnorm(3), stop("bang!")), dots2(1+2, "a", rnorm(3), stop("bang!")), dots3(1+2, "a", rnorm(3), stop("bang!")), dots4(1+2, "a", rnorm(3), stop("bang!")), check = FALSE )[1:4] #> # A tibble: 4 x 4 #> expression...
1999 May 05
1
RNG R/Splus compatibility
...t as I am trying to get the same results from Splus as I get from R. However, there are a couple of R issues: - There is a small change to RNGkind to allow "default" (currently Wichmann-Hill but could change from time to time). -The strategy for specifying the transformation to get rnorm results should be examined, as I think it should be put into R and extended for other random number transformations. Paul Gilbert ________ # First define these 3 functions appropriately if you don't have them already: # is.S <- function(){T or F} # is.R <- function(){T or F} # is.Splus...
2009 Aug 12
2
10x slower merge in mac 2.9.1 vs. 2.9.0 (PR#13890)
Full_Name: Rick Stahlhut Version: 2.9.1 OS: os x 10.5.7 Submission from: (NULL) (128.151.71.23) I upgraded to 2.9.1 today from 2.9.0. I work with large CDC (center for disease control) datasets and start, frequently, with a series of 23 large-ish merges to create the final dataset I work on. I do this each time because (a) R is fast. why not? and b) the datasets occasionally get updated by
2006 Feb 08
3
difference between rnorm(1000, 0, 1) and running rnorm(500, 0, 1) twice
Hi R users This looks a simple question Is there any difference between between rnorm(1000,0,1) and running rnorm(500,0,1) twice in terms of outcome ? TM
2009 Sep 09
2
Matrix multiplication and random numbers
...he for loop in the wrong place. Also when I try and save the matrices using write.table only the first one is saved The code so far is below, any help would be greatly appreciated Cheers Tom InitialPop<-matrix(c(500,0,0,0,0,0,0)) matmult<-function(InitialPop,N){ mat3<-matrix(c(0,rnorm(1,0.6021,0.0987),0,0,0,0,0,0,0,rnorm(1,0.6021,0.0987),0,0,0,0,1.9,0,0,rnorm(1,0.6021,0.0987),0,0,0,4.8,0,0,0,rnorm(1,0.6021,0.0987),0,0,9.7,0,0,0,0,rnorm(1,0.6021,0.0987),0,18,0,0,0,0,0,rnorm(1,0.6021,0.0987),32.6,0,0,0,0,0,0),nrow=7) for (i in 1:N){ PVAmatrix<-matrix(c(0,rnorm(1,0.6021,0.0987)...
2008 May 14
2
mfrow
...rs, I want to create 8 graphs and write it into one page using mfrow=c(4,2). How to make all graphs (including the titles, legends, line types) to be scale down (resized proportionally). As an illustration, below is the code: pdf("testmfrow.pdf") par(mfrow=c(4,2)) x<-seq(1:10) y1<-rnorm(10) y2<-rnorm(10,mean=2,sd=1) y3<-rnorm(10,mean=3,sd=1) y4<-rnorm(10,mean=4,sd=1) y5<-rnorm(10,mean=5,sd=1) y6<-rnorm(10,mean=6,sd=1) y7<-rnorm(10,mean=7,sd=1) y8<-rnorm(10,mean=8,sd=1) plot(x,y1,type='o', lty=1, main="I want this title is to be scaled down (resiz...