Displaying 1 result from an estimated 1 matches for "simset".
Did you mean:
  simses
  
2006 Apr 10
1
Generic code for simulating from a distribution.
...of certain size from a
particular distribution (here,beta distribution) and compute some
statistics for the samples.
betasim2<-function(nsim,n,alpha,beta)
{
	sim<-matrix(rbeta(nsim*n,alpha,beta),ncol=n)
	xmean<-apply(sim,1,mean)
	xvar<-apply(sim,1,var)
	xmedian<-apply(sim,1,median)
simset<-data.frame(sampleno=seq1:nsim),means=xmean,vars=xvar,medians=xmedian)
	return(simset)
}
I can write a similar coding for any distribution individually.
Now, I would like to have a generic code, say if I specify the
distribution with the parameters and simulation and sample size I would
like to...