Displaying 20 results from an estimated 10000 matches similar to: "sample with equal probabilities"
2012 Oct 06
2
sample
Hello
If I have x=c(3,2,6,1) and n=length(x), 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 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]]
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]]
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]]
2009 Aug 21
1
Question about validating predicted probabilities
Hello,
Frank was nice enough to point me to the val.prob function of the Design
library.
It creates a beautiful graph that really helps me visualize how well my
model is predicting probabilities.
By default, there are two lines on the graph
1) fitted logistic calibration curve
2) nonparametric fit using lowess
Right now, the nonparametric line doesn't look very good.
The
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
2011 Aug 24
4
Column of probabilities
Hi all,
I have a vector xm say: xm = c(1,2,3,4,5,5,5,6,6)
I want to return a vector with the corresponding probabilities based on the
amount of times the numbers occurred. For example, I should get the
following vector for xm:
prob.xm = c(1/9, 1/9, 1/9, 1/9, 3/9, 3/9, 3/9, 2/9, 2/9)
Any help greatly appreciated.
--
Thanks,
Jim.
[[alternative HTML version deleted]]
2002 Mar 08
2
? about sample
i am trying to use the
sample command and have one question about it:
i am getting the error
Error in sample(length(x), size, replace, prob) :
insufficient positive probabilities
when i use something like:
sample (1:4, prob=c(0,0,1,0))[1]
i was expecting that to return a 3 every time
while this is not exactly what i am using it for, i need the capabilities to
deal with zeros (as the
2010 Nov 09
1
Question related to combination and the corresponding probability
Dear r users,
I have 4 variables x1,x2,x3,x4 and each one has two levels, for example Y
and N.
For x1: prob(Y)=0.6, prob(N)=0.4;
For x2: prob(Y)=0.5, prob(N)=0.5;
For x3: prob(Y)=0.8, prob(N)=0.2;
For x4: prob(Y)=0.9, prob(N)=0.1;
Therefore, the sample space for (x1, x2, x3, x4)={YYYY, YYYN, YYNY,......}
(16 possible combination) and the corresponding probabilities are
{(0.6)(0.5)(0.8)(0.9),
2016 Mar 10
3
rmultinom.c error probability not sum to 1
Hi all,
I should have given a better explanation of my problem. Here it is.
I extracted from my code the bit that gives the error. Place this in a file called test.c
#include <math.h>
#include <R.h>
#include <Rmath.h>
#include <float.h>
#include <R_ext/Print.h>
int main(){
double prob[3] = {0.0, 0.0, 0.0};
double prob_tot = 0.;
prob[0] = 0.3*dnorm(2, 0,
2006 Dec 30
2
Error: cannot take a sample larger than the population
Hi,
In Splus7 this statement
xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
worked fine, but in R the interpreter reports that the length of the
vector to chose c(0,1,2) is shorter than the size of many times I want
to be selected from the vector c(0,1,2).
Any good reason?
See below the error.
> xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
Error in
2006 Dec 09
1
Error in rmultinom(n, size, prob) : too few positive probabilities
// R 2.3.1
Can someone please explain why this error returns?
> y=numeric(100)
> x=matrix(runif(16),4,4)
> for(i in 2:100)
+ {
+ y[i]=which(rmultinom(1, size = 1, prob = x[y[i-1], ])==1)
+ }
Error in rmultinom(n, size, prob) : too few positive probabilities
thx much
ej
2009 Dec 04
3
Combinations and joint probabilities
Dear R helpers
Suppose I have two sets of ranges (interest rates) as
Range 1 : (7 – 7.50, 7.50 – 8.50, 8.50 – 10.00) with respective probabilities 0.42, 0.22 and 0.36.
Range II : (11-12, 12-14, 14-21) with respective probabilities 0.14, 0.56 and 0.30 respectively.
My problem is to form the combinations of these ranges in a decreasing order of joint probabilities. It is assumed that
2007 Oct 17
3
how to repeat the results of a generated probabilities
hello,
I want to simulate 200 times the mean of a joint probability (y1) and 200
times the mean of another joint distribution (y2),
that is I'm expecting to get 200 means of y1 and 200 means of y2.
y1 and y2 are probabilities that I calculate from the marginal prob. (z1 and
z2 respectively) multiple by the conditional prob. (x1 and x2 respectively),
which I generaterd from the binomial
2008 Feb 07
0
Sampling with unequal probabilities
This is in followup to a thread on R-help with subject "Sampling".
I claim that R does the wrong thing by default when
sampling with unequal probabilities without replacement -
the selection probabilities are not proportional to 'prob',
for any draw after the first: I suggest that R do what S-PLUS now does
(though you're free to choose a better implementation).
What S-PLUS
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]]
2006 Oct 06
1
Sum of Bernoullis with varying probabilities
Hi Folks,
Given a series of n independent Bernoulli trials with
outcomes Yi (i=1...n) and Prob[Yi = 1] = Pi, I want
P = Prob[sum(Yi) = r] (r = 0,1,...,n)
I can certainly find a way to do it:
Let p be the vector c(P1,P2,...,Pn).
The cases r=0 and r=n are trivial (and also are exceptions
for the following routine).
For a given value of r in (1:(n-1)),
library(combinat)
Set <- (1:n)
2013 Jan 29
1
Finding predicted probabilities and their confidence intervals for a logit model
I want to construct a logit model, plot the probability curve with the
confidence intervals, and then I want to
print out a data frame with the predictor, response value, predicted value,
the low ci predicted value, and the
high ci predicted value. So it should look something like:
value low_ci prob hi_ci
5 0.10 0.12 0.13
6 0.11 0.13 0.16
7 0.13 0.15
2011 Feb 22
0
why no "probabilities" from svm.predict?
> library(ROCR)
> library(e1071)
svmres.prob <- svm(traindx, traindy, probability=TRUE)
svmpred.prob <- predict(svmres.prob, testdx, probability = TRUE,
decision.values = TRUE, type="prob")
> print(length(attr(svmpred.prob, "probabilities")))
[1] 0
> print(attr(svmpred.prob, "probabilities"))
NULL
> print(attributes(svmpred.prob)$decision.values)
2008 Jan 10
0
prob package: elementary probability on finite sample spaces
Dear R Community,
I am pleased to announce the beta-release of the prob package. The
source code is now on CRAN, and binaries should be generated there
before long. In the meantime, you can get it with
install.packages("prob", repos = "http://r-forge.r-project.org")
The prob package gives a framework for doing elementary probability on
finite sample spaces in R. The