View source: R/pottwhitt.stat.R
pottwhitt.stat | R Documentation |
Compute Pottwhoff-Whittinghill's statistic.
pottwhitt.stat computes the test statistic and the test using a hi-square distribution whilst pottwhitt.test performs a bootstrap test.
pottwhitt.stat(data)
pottwhitt.test(formula, data, model, R, ...)
formula |
Formula that specifies the underlying model. The observed cases are the response and the expected number of cases must be specified as an offset in the log scale (see example below). Note that now it is not necessary to use Observed and Expected and that any other names can be used to specify the observed and expected cases. |
model |
Parametric model to be used in the bootstrap test. One of "param", "multinom", "poisson" or "negbin". See the DCluster manpage for details. |
... |
The remaining arguments in 'achisq.stat' not included in 'achisq.test'. This is done so because achisq.test calls achisq.stat in order to perform the test. |
R |
Number of replicates used in the test to compute the significance of the observed value of the test statistic. |
data |
A dataframe containing the data, as specified in the DCluster manpage. |
A list with the following elements:
T |
The value of the statistic. |
asintmean |
Mean of the asymptotical Normal distribution. |
asintvar |
Variance of the asymptotical Normal distribution. |
pvalue |
Significance of the statistic. |
Potthoff, R. F. and Whittinghill, M.(1966). Testing for Homogeneity: I. The Binomial and Multinomial Distributions. Biometrika 53, 167-182.
Potthoff, R. F. and Whittinghill, M.(1966). Testing for Homogeneity: The Poisson Distribution. Biometrika 53, 183-190.
DCluster
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)
pottwhitt.stat(sids)
pottwhitt.test(Observed~offset(log(Expected)),sids, model="poisson", R=99)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.