observed.sim: Randomly Generate Observed Cases from Different Statistical...

Description Usage Arguments Value See Also Examples

Description

Simulate Observed number of cases according to a Multinomial, Poisson or Negative Binomial distribution.

These functions are used when performing a parametric bootstrap and they must be passed as argument ran.gen when calling function boot.

multinom.sim generates observations from a Multinomial distribution.

poisson.sim generates observations from a Poisson distribution.

negbin.sim generates observations from a Negative Binomial distribution.

Usage

1
2
3
4
5

Arguments

data

A dataframe as described in the DCluster manual page.

mle

List containing the parameters of the distributions to be used. If they are not provided, then they are calculated from the data. Its value argument mle in function boot.

The elements in the list depend on the distribution to be used:

  • Multimonial

    Total observed cases (n) and vector of probabilities (p).

  • Poisson

    Total number of regions (n) and vector of means (lambda).

  • Negative Binomial

    Total number of regions (n) and parameters nu and alpha of the Gamma distribution.

Value

A dataframe equal to the argument data, but in which the Observed column has been substituted by sampled observations. See DCluster manual page for more details.

See Also

DCluster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(spdep)

data(nc.sids)

sids<-data.frame(Observed=nc.sids$SID74)
sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74))
sids<-cbind(sids, x=nc.sids$x, y=nc.sids$y)

#Carry out simulations
datasim<-multinom.sim(sids, mle=calculate.mle(sids, model="multinomal") )

#Estimators for Poisson distribution
datasim<-poisson.sim(sids, mle=calculate.mle(sids, model="poisson") )

#Estimators for Negative Binomial distribution
datasim<-negbin.sim(sids, mle=calculate.mle(sids, model="negbin") )


DCluster documentation built on May 21, 2017, 3:42 a.m.
Search within the DCluster package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.