# NOT RUN {
## Determine mean/variance of the number of singleton clusters for dynamic
## MFM model conditional on K+ = 5, alpha = 1 with a sample size N = 100.
## We assume that K will be smaller than 30 by setting maxK = 30, please
## increase this value for more realistic analysis.
##
## First create the function singletons():
singletons <- fipp(lfunc = function(n) log(n==1), Kplus = 5, N = 100,
type = "dynamic", alpha = 1, maxK = 30)
## Then evaluate it using a Geom(0.1) prior:
singletons(dgeom, list(prob = 0.1))
## Try a different prior, the Poisson prior Pois(1):
singletons(dpois, list(lambda = 1))
## If mean is the only thing you are interested in, try the following:
singletons(dpois, list(lambda = 1), order = 1)
## Also, if you want 1st/2nd moments instead of mean/variance, try:
singletons(dpois, list(lambda = 1), replace2ndwvar = FALSE)
# }
Run the code above in your browser using DataLab