Learn R Programming

rms.gof (version 1.0)

rms.pval: P-value for root-mean-square goodness-of-fit test for simple null hypothesis

Description

Returns the P-value associated with a root-mean-square test.

Usage

rms.pval(observed, expected, num_sim= 1000)

Arguments

observed
The observed data
expected
The expected data
num_sim
Number of Monte-Carlo simulations desired. The default is 1,000 simulations.

Value

Returns the P-value associated with the root-mean-square test.

Details

This function calls on test.rms() to calculate the root-mean-square test statistic before calculating the P-value using Monte-Carlo simulation.

References

"Chi-square and classical exact tests often wildly misreport significance; the remedy lies in computers," by Will Perkins, Mark Tygert, and Rachel Ward.

See Also

test.rms

Examples

Run this code
#This example is from section 5.1.2 of the referenced text

k <- c(1:128)
#Define model distribution (exp) and observed distribution (obs)
C1 <- 1/sum(1/k)
exp <- C1/k

C2 <- 1/sum(1/k^2)
obs <- C2/k^2

rms.pval(obs,exp,10000)

Run the code above in your browser using DataLab