Displaying 20 results from an estimated 20000 matches similar to: "sample"
2012 Oct 06
1
sample with equal probabilities
Hello
If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one value from x , and each value of x has equal probability to appear (1/n).
Are the following codes equivalent??
sample(x,1,replace=TRUE) and sample(x,1,replace=TRUE,prob=rep(1/n , n))
Regards
[[alternative HTML version deleted]]
2012 Jun 18
2
out put of loop in list
Hello
I have a loop to draw few samples and I want to but this samples in one list, how I can make this? when I use it , the list show just the last sample. I want to know the correct way to put all samples in one list.
Regards
Sulafah
[[alternative HTML version deleted]]
2012 Jun 30
3
loop in list
Hello
I have a loop to sample 20 samples and I want to put them in one list, how I can make this??
Regards
Sulafah
[[alternative HTML version deleted]]
2011 Apr 15
3
Monte Carlo Simulation
Hello, R friends...
I am very new to R, and I need some help. I am trying to construct a simulation for my dissertation.
I need to create 1000 datasets of 1000 subjects with the following variables...
Treatment variable - Drawn from a binomial distribution (1 run, prob=.13)
Covariate 1 - Drawn from a normal distribution (mean=100, sd=16)
Covariate 2 - Drawn from a normal distribution
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]]
2013 May 23
1
sample(c(0, 1)...) vs. rbinom
Greetings.? My wife is teaching an introductory stat class at UC Davis.? The
class emphasizes the use of simulations, rather than mathematics, to get
insight into statistics, and R is the mandated tool.?? A student in the class
recently inquired about different approaches to sampling from a binomial
distribution.? I've appended some code that exhibits the idea, the gist of
which is that using
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel.
R-3.5.1 behaves as expected.
`epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced.
Chuck
> set.seed(123)
>
> epsilon <- 1e-10
>
> ## uniform to 200 then small
> p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200)))
> ## uniform to 201
2013 Jan 02
2
SIGN.test
Hello
I used SIGN.test function in R 2.12.2 to apply one sample sign test and it is worked well ,but I want to put statistic in a variable and I could not get this value,
I used :
x=rnorm(100)
t=SIGN.test(x,md=0,alt="less")
t$rval[1]$statistic
the last command work in the old version of R but it does not work in R 2.12.2. what can I do to get value of statistic??
Regards
Sulafah
2006 Aug 04
2
Sampling from a Matrix
Hello all,
Consider the following problem:
There is a matrix of probabilities:
> set.seed(1)
> probs <- array(abs(rnorm(25, sd = 0.33)), dim = c(5,5), dimnames = list(1:5, letters[1:5]))
> probs
a b c d e
1 0.21 0.27 0.50 0.0148 0.303
2 0.06 0.16 0.13 0.0053 0.258
3 0.28 0.24 0.21 0.3115 0.025
4 0.53 0.19 0.73 0.2710 0.656
5 0.11 0.10 0.37 0.1960
2018 Feb 26
3
Random Seed Location
Hi all,
For some odd reason when running na?ve bayes, k-NN, etc., I get slightly
different results (e.g., error rates, classification probabilities) from run
to run even though I am using the same random seed.
Nothing else (input-wise) is changing, but my results are somewhat different
from run to run. The only randomness should be in the partitioning, and I
have set the seed before this
2018 Feb 27
0
Random Seed Location
In case you don't get an answer from someone more knowledgeable:
1. I don't know.
2. But it is possible that other packages that are loaded after set.seed()
fool with the RNG.
3. So I would call set.seed just before you invoke each random number
generation to be safe.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking
2018 Mar 04
3
Random Seed Location
On Mon, Feb 26, 2018 at 3:25 PM, Gary Black <gwblack001 at sbcglobal.net>
wrote:
(Sorry to be a bit slow responding.)
You have not supplied a complete example, which would be good in this
case because what you are suggesting could be a serious bug in R or a
package. Serious journals require reproducibility these days. For
example, JSS is very clear on this point.
To your question
>
2018 Mar 04
0
Random Seed Location
Thank you, everybody, who replied! I appreciate your valuable advise! I will move the location of the set.seed() command to after all packages have been installed and loaded.
Best regards,
Gary
Sent from my iPad
> On Mar 4, 2018, at 12:18 PM, Paul Gilbert <pgilbert902 at gmail.com> wrote:
>
> On Mon, Feb 26, 2018 at 3:25 PM, Gary Black <gwblack001 at sbcglobal.net>
>
2006 Aug 06
1
Take random sample from class variable
Dear all,
Suppose I have a dataset like below, then I take for example, 100
random sample "class" variable where contains "yes" and "no"
respectively, 70% and 30%.
I need a new 100 random sample from mydat dataset, but I can't get the result.
Thanks you very much for any helps.
Best, Muhammad Subianto
mydat <- data.frame(size=c(30,12,15,10,12,12,25,30,20,14),
2010 Oct 11
2
compare histograms
Hello
How to compare two statistical histograms? How i can know if these histograms are equivalent or not??
Regards
[[alternative HTML version deleted]]
2018 Mar 04
2
Random Seed Location
The following helps identify when .GlobalEnv$.Random.seed has changed:
rng_tracker <- local({
last <- .GlobalEnv$.Random.seed
function(...) {
curr <- .GlobalEnv$.Random.seed
if (!identical(curr, last)) {
warning(".Random.seed changed")
last <<- curr
}
TRUE
}
})
addTaskCallback(rng_tracker, name = "RNG tracker")
EXAMPLE:
>
2018 Mar 04
0
Random Seed Location
On 04/03/2018 5:54 PM, Henrik Bengtsson wrote:
> The following helps identify when .GlobalEnv$.Random.seed has changed:
>
> rng_tracker <- local({
> last <- .GlobalEnv$.Random.seed
> function(...) {
> curr <- .GlobalEnv$.Random.seed
> if (!identical(curr, last)) {
> warning(".Random.seed changed")
> last <<- curr
2009 Jan 28
1
stack data sets
Hi All,
I'm generating 10 different data sets with 1 and 0 in a matrix form and writing the output in separate files. Now I need to stack all these data sets in one vector and I know that stack only operates on list or data frame however I got these data sets by converting list to a matrix so can't go backwards now. Is there a way i can still use Stack?
Please see the program:
2008 Oct 16
1
apply, t-test and p-values
R 2.7.2
Windows XP
I am using apply to compute a series of Student's t-test from two matrices, sample1 and sample2.
boo<-apply(sample1,1,t.test,sample2)
I want to pick of the p-values from the tests, but can't seem to get it to work. I have tried several methods to get the values including:
boo<-apply(sample1,1,t.test$t.test,sample2)
boo<-apply(sample1,1,t.test,sample2)$t.test
2011 Jul 31
4
Error in plotmath
Under
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 2
minor 13.1
year 2011
month 07