Displaying 1 result from an estimated 1 matches for "initial_mean".
2006 Feb 18
1
truncated negative binomial using rnegbin
...unction to generate a vector containing values from a truncated
# negative binomial distribution (i.e., no zeros). Select desired
# mean and variance, sample size, initial values for mean and theta,
# and a threshold value for tests.
#
# format: out<-nbin(desired_mean, desired_variance, n, initial_mean,
# theta, threshold_level)
#
# example: out<-nbin(2, 1, 100, 2, 2, 0.1)
#
#
nbin<-function(mu.s,var.s,n,mu.i,theta,test)
{
library(MASS)
mu<-0
var<-0
rand<-rep(0,n)
while(abs(mu.s-mu)>=test & abs(var.s-var)>=test)
{
for(i in 1:n...