similar to: random sampling matrix

Displaying 20 results from an estimated 11000 matches similar to: "random sampling matrix"

2007 Jul 07
2
random sampling with some limitive conditions?
I want to gain thousands of random sampling data by randomizing the presence-absence data. Meantime, one important limition is that the row and column sums must be fixed. For example, the data "tst" is following: site1 site2 site3 site4 site5 site6 site7 site8 1 0 0 0 1 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0
2005 Oct 03
6
sampling vectors
Hello Listers, I am trying to sample a vector to create a new one of sample length, witha sum equal to the sum of the initial vector: initial = 10, 30, 10 (sum=50) sample example = 5, 35, 10 (sum=50) or 25, 15, 10 (sum=50), etc ... My problem is to control the sum, so it stays constant. Any suggestions would be very helpful ! Thank you in advance, Eric
2010 Dec 23
1
Reconcile Random Samples
Is there a way to generate identical random samples using R's runif function and SAS's ranuni function? I have assigned the same seed values in both software packages, but the following results show different results. Thanks! R === > set.seed(6) > random <- runif(10) > random [1] 0.6062683 0.9376420 0.2643521 0.3800939 0.8074834 0.9780757 0.9579337 [8] 0.7627319 0.5096485
2009 Dec 18
2
how to combine multiple indicator variables in a single factor
Say I have a dataframe like this: df <- data.frame(cbind(c(1,0,0,1),c(0,1,0,0),c(0,0,1,0))) names(df) <- c('a','b','c') I would like to create a factor in a new column, where the factor values are taken from the column names, like this: > df2 a b c f 1 1 0 0 a 2 0 1 0 b 3 0 0 1 c 4 1 0 0 a How would I do this? Thanks, Dan Daniel Nordlund Bothell, WA USA
2009 Aug 24
6
Combining matrices
If I have two matrices like x <- matrix(rep(c(1,2,3),3),3) y <- matrix(rep(c(4,5,6),3),3) How can I combine them to get ? 1 1 1 4 4 4 1 1 1 5 5 5 1 1 1 6 6 6 2 2 2 4 4 4 2 2 2 5 5 5 2 2 2 6 6 6 3 3 3 4 4 4 3 3 3 5 5 5 3 3 3 6 6 6 The number of rows and the actual numbers above are unimportant, they are given so as to illustrate how I want to combine the matrices. I.e., I am looking for
2007 Apr 20
4
importing sas datasets
Hello, I wanted to ask help about importing sas datasets. 1)I tried with some functions as read.ssd (foreign package), but it doesn't import the file if the length of the variables' names are longer than 8 bite (it has to conform to the 6 version). 2)I then tried with the sas.get function (Hmisc package) but with the command: c<- sas.get(lib="c:\\ghan",
2011 Mar 09
2
Complex sampling?
R users, I am trying to generate a randomized weekday survey schedule that ensures even coverage of weekdays in the sample, where the distribution of variable DOW is random with respect to WEEK. To accomplish this I need to randomly sample without replacement two weekdays per week for each of 27 weeks (only 5 are shown). However, I need to sample from a sequence (3:7) that needs to be
2012 Jul 27
2
How can I access an element of a string?
Dear Daniel and Jorge, Thank you very much and it does help. If I have a string "ABCD", how can I access the second element of the string "B"? Thanks, Miao 2012/7/27 Daniel Nordlund <djnordlund@frontier.com> > > -----Original Message----- > > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] > > On Behalf Of jpm miao
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]]
2007 Apr 19
1
Random number generator in R compared
I am trying to generate survival data using R .Im trying to randomly generate a column of 1s and 0 and another column randomly generated using an exponential distribution but l cant seem to get the random function. how do l go about it thanks in advance rt chiruka --------------------------------- [[alternative HTML version deleted]]
2009 Mar 03
1
R - need more memory, or rejection sampling algorithm doesn't work?
Hi all, I am trying to run rejection sampling for the quantity z11 in the function below. Unfortunately I can't simplify the function further so that z11 only appears once. Whenever I run the algorithm, R looks as if it is running it (no error messages or anything), but then nothing happens for minutes...how long should it take to run something like this in R? I have tried in in both linux
2010 Feb 11
2
SAS and RODBC
I am using R-2.10.1 binary from CRAN on a WinXP Pro system. I also use SAS v9.2 on the same box. I just started using the SAS ODBC driver that comes with version 9 of SAS. I have been able to set up an ODBC source for SAS datasets using the driver, and then with RODBC I am able to read a sample SAS dataset. > library(RODBC) > ch <- odbcConnect('sasodbc', believeNRows=FALSE)
2012 Mar 23
4
Missing Windows binary for R-2.15RC?
Hi, The page http://cran.r-project.org/bin/windows/base/rtest.html has a link to: http://cran.r-project.org/bin/windows/base/R-2.15.0rc-win.exe However, clicking on that link gives a 404 "Object not found' error. FYI. Dan
2011 Nov 07
3
Sampling with conditions
Hey everyone, I am at best, an amateur user of R, but I am stuck on how to set-up the following situation. I am trying to select a random sample of numbers from 0 to 10 and insert them into the first column of a matrix (which will used later in a loop). However, I need to have those numbers add up to 10. How can I set those conditions? So far I have: n<-matrix(0,nr=5,ncol=10) for(i in
2010 Oct 09
4
same random numbers in different sessions
Dear all I'm using Xubuntu Lucid and I keep getting the same random numbers whenever I start a new session of R. For example, I keep getting > sample(1:1000, 1) [1] 87 or > rnorm(1:10) [1] -1.3618103 0.4241701 1.0720076 0.2208145 -0.5375314 -0.4846588 [7] 0.7576768 0.6527407 -0.6868786 0.8718527 I expected that some set.seed() instruction woudl be present in a config file in
2013 Feb 18
2
Random number generator used in 'runif'
Dear list, For the implementation of a particular optimization algorithm it is very important the random number generator. I would like to know if somebody could tell me what is the random number generator used by default in the 'runif' function. >From the help page of 'runif' and '.Random.seed' I guess that the default algorithm is 'Mersenne-Twister', but I
2011 Feb 10
1
Revolution Analytics reading SAS datasets
Has anyone heard whether Revolution Analytics is going to release this capability to the R community? http://www.businesswire.com/news/home/20110201005852/en/Revolution-Analytics-Unlocks-SAS-Data Dan Daniel Nordlund Bothell, WA USA
2006 Oct 09
1
where "should" R be installed?
I am a new user of Linux (long time user of Windows) whose only training is from books, articles, and just playing with Linux. I have built and installed R from source, and also installed from RPMs (SuSE). I am wondering where in the file system experienced users of R and Linux typically install R. Are there any conventions, or any reasons to choose one location over another? I know that
2009 May 17
1
sprintf() question
When I type the following, I get results different from what I expected. > sprintf('%a',3) [1] "0x1.8" Shouldn't the result be [1] "0x1.8p+2" I read through the help ?sprintf and didn't find anything that changed my expectation. What am I misunderstanding? I am using R-2.9.0 binary from CRAN on Windows XP Pro, and my session info is >
2009 May 17
1
sprintf() question
When I type the following, I get results different from what I expected. > sprintf('%a',3) [1] "0x1.8" Shouldn't the result be [1] "0x1.8p+2" I read through the help ?sprintf and didn't find anything that changed my expectation. What am I misunderstanding? I am using R-2.9.0 binary from CRAN on Windows XP Pro, and my session info is >