Hello!
I am looking for some help with an Intro to R homework from a professor who doesn't clearly explain the things we need to know for the homework in class...:shakehead
I'm trying to figure out how to write a function to simulate the sampling distribution of the mean when the population has a binomial distribution. The function should have the following form:
centralLimit = function(nreps, nobs, trials, ps, hist=FALSE, qqnorm=FALSE, ...)
My already written code defining the variables is here:
# number of samples
nreps = 10000
# number of observations in each sample
nobs = 100
# number of trials in each observation
trials = 5
# probability of "success" in each trial
ps = .1
# generate data
binomSamps = lapply(rep(nobs,nreps), rbinom, size=trials, prob=ps)
# compute sample means
mymeans = sapply(binomSamps, mean)
Any help would be much appreciated!!
I am looking for some help with an Intro to R homework from a professor who doesn't clearly explain the things we need to know for the homework in class...:shakehead
I'm trying to figure out how to write a function to simulate the sampling distribution of the mean when the population has a binomial distribution. The function should have the following form:
centralLimit = function(nreps, nobs, trials, ps, hist=FALSE, qqnorm=FALSE, ...)
My already written code defining the variables is here:
# number of samples
nreps = 10000
# number of observations in each sample
nobs = 100
# number of trials in each observation
trials = 5
# probability of "success" in each trial
ps = .1
# generate data
binomSamps = lapply(rep(nobs,nreps), rbinom, size=trials, prob=ps)
# compute sample means
mymeans = sapply(binomSamps, mean)
Any help would be much appreciated!!