Goodness-of-fit test for one sample data with two bootstrap methods: multiplier bootstrap and parametric bootstrap. The multipler bootstrap method is faster, using generic numeric derivatives.

1 2 3 4 5 |

`x` |
a vector or matrix of data to be tested. |

`distr` |
name of the hypothesized distribution, assuming that dpr functions are available for density, distribution, and random number generation. For example, if "foo" is the hypothesized distribution, then functions "dfoo", "pfoo", and "rfoo" must be available. |

`nsim` |
the bootstrap sample size. |

`start` |
a list of named components for the starting value of the parameter estimate. |

`ng` |
The size of the grid points for numerical integration. |

`simulation` |
method of bootstrap: "mult" for multiplier bootstrap; "pb" for parametric bootstrap. |

`qgrid` |
method to construct the grid for numerical integration: "empirical" for empirical quantiles; "fitted" for fitted quantiles. |

`gridStat` |
Not used for one dimensional distribution now. |

`method.args` |
a list of arguments to control the "method.args" for |

`derCdfWrtPar` |
derivative function of the cdf with respect to parameters. The dedault is NULL, in which case, numerical derivative is used. |

`derLogPdfWrtPar` |
derivative function of the logPdf with respect to parameters. The dedault is NULL, in which case, numerical derivative is used. |

`...` |
other arguments to be passed to dpr function of the distribution. |

The function has been fully tested with dimension 1. For higher dimensions, wrapper functions are often needed. Examples will be provided in future releases.

a list with the following components:

`statistic` |
vector of test statistics |

`p.value` |
vector of p-values of the test statistics |

`estimate` |
vector of estimated parameter values |

`stat.sim` |
matrix of bootstrap draws of the test statistics |

Ivan Kojadinovic and Jun Yan.

Kojadinovic I. and Yan J.: Goodness-of-fit testing based on a weighted bootstrap: A fast large-sample alternative to the parametric bootstrap. Canadian Journal of Statistics. Forthcoming.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
set.seed(123)
n <- 200
x <- rlnorm(200, 1, 1)
system.time(m1 <- gof.test(x, "lnorm", 1000, list(meanlog=1, sdlog=1), simulation="pb"))
system.time(m2 <- gof.test(x, "lnorm", 200, list(meanlog=1, sdlog=1), simulation="mult"))
apply(m1$stat.sim, 1, summary)
apply(m2$stat.sim, 1, summary)
system.time(m1 <- gof.test(x, "gamma", 1000, list(shape=1, rate=1), simulation="pb"))
system.time(m2 <- gof.test(x, "gamma", 200, list(shape=1, rate=1), simulation="mult"))
apply(m1$stat.sim, 1, summary)
apply(m2$stat.sim, 1, summary)
system.time(m1 <- gof.test(x, "exp", 1000, list(rate=1), simulation="pb"))
system.time(m2 <- gof.test(x, "exp", 200, list(rate=1), simulation="mult"))
apply(m1$stat.sim, 1, summary)
apply(m2$stat.sim, 1, summary)
``` |

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

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

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