The Stack Overflow podcast is back! Listen to an interview with our new CEO.

All Questions

Tagged with
116 questions
Filter by
Sorted by
Tagged with
31k views

Generating random samples from a custom distribution

I am trying to generate random samples from a custom pdf using R. My pdf is: $$f_{X}(x) = \frac{3}{2} (1-x^2), 0 \le x \le 1$$ I generated uniform samples and then tried to transform it to my custom ...
7k views

How to draw random samples from a non-parametric estimated distribution?

I have a sample of 100 points which are continuous and one-dimensional. I estimated its non-parametric density using kernel methods. How can I draw random samples from this estimated distribution?
589 views

Estimate the size of a population being sampled by the number of repeat observations

Say I have a population of 50 million unique things, and I take 10 million samples (with replacement)... The first graph is I've attached shows how many times I sample the same "thing", which is ...
11k views

Cluster Big Data in R and Is Sampling Relevant?

I'm new to data science and have a problem finding clusters in a data set with 200,000 rows and 50 columns in R. Since the data have both numeric and nominal variables, methods like K-means which ...
12k views

How to resample in R without repeating permutations?

In R, if I set.seed(), and then use the sample function to randomize a list, can I guarantee I won't generate the same permutation? ie... ...
7k views

Sampling with replacement in R randomForest

The randomForest implementation does not allow sampling beyond the number of observations, even when sampling with replacement. Why is this? Works fine: ...
1k views

2k views

What is behind JAGS (Just Another Gibbs Sampler)?

I have been using JAGS but I am not quite sure how it actually simulates it values. I need to know in a general sense what's going on in the background.
2k views

Downsampling excessively sampled curves

I'm looking for a quick (event if not so accurate) way to deal with over-sampled curves using R. Consider the following example in which x contains 1000 values in ...
72 views

Is there a more efficient method for creating a probability distribution?

I have written a short function in R to estimate the expected number of mutations that will be observed in a set of DNA sequences. The parameters are the mutation rate (x), the length of the DNA ...
260 views

How to sample from a distribution so that mean of samples equals expected value?

Given a random variable $X$, how do I have obtain $N$ random variates of $X$ so that the mean value of my samples equals the expected value of $X$? E.g. let $X$ have uniform distribution on the ...
1k views

Sampling from empirical distribution

I have a vector of y (min is > 0, max could be 1), for which, i have no idea what distribution is. But based on the data we have, vector y, we can get the empirical cumulative probability distribution,...
750 views

Has anyone publicly shared an implementation of RUSBoost in R?

There's no package available on CRAN, so I was hoping someone in the community had written their own function/package. I see it's been done in MATLAB, so I may just have to start with that and write ...
73 views

Repeated catch–mark–release (urn problem)

Imagine I have a small pond with some fish in it and I want to estimate its population size. I don't have a lot of resources at hand, in fact all I do have is a fishing pole, pen and paper, and a lot ...
279 views

Sample selection and variation in the variable of interest when using panel data

I wonder how to reason when selecting samples. I am doing a panel data regression analysis about how the euro membership correlates with the budget deficit in the member countriues. Using R that is: ...
83 views

How to testing the probability of two factors being found together?

I know how many times a particular factors has been found: values<-cbind(f=c("S1","S10","S3","S4","S5","S6","S7","S8","S9"),count=c(9,8,4,24,20,4,8,21,5)) I ...