Displaying 20 results from an estimated 70000 matches similar to: "How to generate fake population (ie. not sample) data?"
2007 Dec 10
1
Estimating the variability of a population by one sample?
Hi all,
I am meetting one problem.I am estimating the variability of a
population using one sample.I must do two-side and one-side hypothesis
test,and estimate the confidence interval,But I don't know which
function I can use !
Thank you !
2010 Jul 26
1
Sample size calculation for non-normal population with unknown mean and SD
Basically, we have a population of 4,392 documents and we want to find out
the number of patents per document. We don?t want to go through all 4,392
documents, but want a reliable sample size from which to draw inferences. I
feel like this count data will not follow a normal distribution, but more
like a Poisson (skewed right.) The problem is we don?t have much similar
data to this data set, so
2009 Sep 28
2
Regression line w/ residuals - tuning the plot
Hello everybody,
I am sure this is a beginners' problem which is being asked
recurrently every few months, but nevertheless I wasn't able to find
the answer searching through the r-help list.
So here is my problem: I would like to plot a set of points (y vs. x),
a (linear) regression line through them, and on the second graph
underneath the first one I would want to plot residuals vs. x.
2007 Apr 20
1
sequential for loop
Hi all,
I'm usually comfortable using the *apply functions for vectorizing loops
in R. However, my particular problem now is using it in a sequential
operation, which uses values evaluated in an offset of the loop vector.
Here is my example using a for loop approach:
dat <- data.frame(year=rep(1970:1980,each=365),yday=1:365)
dat$value <-
2009 Apr 07
0
Comparing Sample / Population Geographic Distributions
I am trying to confirm that the sample is not different from the population
with respect to geographical respresentation for the following data:
region population sample n_total s_total
1 north 1244 232 9077 1032
2 south 4333 100 9077 1032
3 east 1500 200 9077 1032
4
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
2008 Apr 07
1
test for the variance of a normal population
Hi,
Does anyone know an instruction to perform a test (or to construct a confidence interval) for the variance of a normal population (distribution).
The test statistic is (n-1)*S´^2/sigma^2 and has chi square (n-1) distribution.
Thank you,
Alexandra
[[alternative HTML version deleted]]
2011 Dec 13
2
Generating input population for microsimulation
Hi all,
I've been struggling with some code and was wondering if you all could help.
I am trying to generate a theoretical population of P people who are housed within X different units. Each unit follows the same structure- 10 people per unit, 8 of whom are junior and two of whom are senior. I'd like to create a unit ID and a unique identifier for each person (person ID, PID) in the
2008 Jan 16
1
Probability weights with density estimation
I am a physician examining an NHANES dataset available at the NCHS
website:
http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/demo_d.xpt
http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/hdl_d.xpt
http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/tchol_d.xpt
Thank you to the R authors and the foreign package authors in
particular. Importing from the SAS export
2001 Nov 20
3
Sampling from a population
Hi ALL:
Suppose you have a population of N <- 5 observations, x <- c(43, 28, 7, 61, 39). From that you can draw a maximum of 10 samples without replacement of size n <- 3. (Command choose(N,n) yields 10). For instance the samples I seek are
43, 61, 7
39, 7, 28 ...etc
How can I get R to do that for me, to get an exhaustive list of samples of size n drawn without replacement
2010 Jul 24
1
Doubt about a population competition function
Hi,
I'm doing a function that describe two populations in competition.
that's the function that i wrote:
exclusao<-function(n10, n20, k1, k2, alfa, beta, t){
n1<-k1-(alfa*n20)
n2<-k2-(beta*n10)
if(t==0){plot(t, n10, type='b', xlim=range(c(1:t),c
(1:t)), ylim=range(n10, n20), xlab='tempo',
ylab='tamanho populacional')
points(t, n20, type='b',
2012 Feb 06
3
Duplicate rows when I combine two data.frames with merge!
Hello all,
First I have done extensive searches on this forum and others and nothing
seems to work. So I decided to post thinking someone could point me to the
write post or give me some help.
I have drawn a 100 samples from a fictitious population (N=1000), and then
randomly selected 25% of the 100 samples. I would like to now merge the
data.frame from the 100 samples with the data.frame for
2008 Dec 15
1
Population Decay in R
Hi,
I am new to R. I am trying to plot the decay of a population over time
(0-50yrs). I have the initial population value (5000) and the mortality
rate (0.26/yr) and I can't figure out how to apply this so I get a remaining
population value each year. In excel (ignoring headings) I would put 5000
in A1, in B2 I would enter the formula A1*0.26, and then in A2 (the next
years population) I
2000 Jun 15
1
proportions - finite population correction
> Dear R-users!
>
> I am using R 1.0.0 and Windows NT 4.0.
>
Suppose I have a population of N=100 subjects, a binomial variable and a
random sample of n=20 subjects from my population, giving 15 "successes". I
am interested in obtaining a confidence interval for the proportion of
"successes" in my population.
In R, I can use
> library(ctest)
>
2009 Apr 17
3
rnorm() converted to daily
yearly 8% drift, 25% sd
why are x and y so different (x and z look ok)?
Does this have something to do with biases due to the relationship between
population and sample-estimates as a function of n samples and sd? Or am I
doing something wrong?
-----------------------------------------------------------------------
set.seed( 1 );
x <- mean( rnorm( 100000, mean=0.08, sd=0.25 ));
set.seed( 1
2013 Feb 18
1
help with population matrix
Hi guys, I am a biologist and an R newbie, and I'm learning how to create a
simple population model.
So, I have a population matrix ("pop")of 30 age classes of female (1:4 are
non-breeders, 5:30 are breeders) which will be modelled for 100 years.
> pop <- matrix(0,30,100)
I then populate this matrix with 3 young adult females.
> pop[5, 1] <- 3
I then want to run this
2005 Dec 08
1
Listing all possible samples of size n form a population of size N
Dear useRs!
I would like to list all possible samples of size n form a population of
size N. Obviously, N must be small (up to 20??) for this to be possible.
For example, let say that N = 3 and n = 2. Therefore, we can say we have
units 1, 2 and 3. I believe all possible samples are : {1,2},{2,3} and
{1,3}.
I would like to emphasize that I am not looking for the number of different
2009 Dec 02
1
Lattice: multiple data sets on same plot
Hi,
I have two data sets; one is a population and the other a sample of
that population. I am trying to plot both on the same trellis display.
# Example data set with two numerical attributes and two categorical
pop <- data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500))
cat<-(runif(2000)<=.5)+0
for(i in 1:length(cat)){
if(cat[i] == 0){
pop[i,"cat1"] =
2008 Dec 22
2
... (dotMethods) and cbind/rbind: how to give the signature?
Dear List,
I'm struggling with the signature writing cbind/rbind functions for a S4
class.
First of all, I'm very happy that it is now possible to dispatch on ...
I follow the example for "paste" in ?dotMethods, which works as far as this:
### start example
setClass ("cbtest",
representation = representation (data = "data.frame"),
2009 Nov 16
2
Conditional statement
Dear useRs,
I wrote a function that simulates a stochastic model in discrete time.
The problem is that the stochastic parameters should not be negative and sometimes they happen to be.
How can I conditionate it to when it draws a negative number, it transforms into zero in that time step?
Here is the function:
stochastic_prost <- function(Fmean, Fsd, Smean, Ssd, f, s, n, time, out=FALSE,