R Development Page
countreg log file (check_x86_64_linux)
Mon Aug 5 16:45:22 2024: Checking package countreg (SVN revision 243) ...
* using log directory ‘/srv/rf/building/build_2024-08-05-16-44/RF_PKG_CHECK/PKGS/countreg.Rcheck’
* using R version 4.4.1 Patched (2024-07-31 r86945)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
gcc (Debian 12.2.0-14) 12.2.0
GNU Fortran (Debian 12.2.0-14) 12.2.0
* running under: Debian GNU/Linux 12 (bookworm)
* using session charset: UTF-8
* using option ‘--as-cran’
* checking for file ‘countreg/DESCRIPTION’ ... OK
* this is package ‘countreg’ version ‘0.3-0’
* checking CRAN incoming feasibility ... [6s/16s] NOTE
Maintainer: ‘Achim Zeileis ’
New submission
Suggests or Enhances not in mainstream repositories:
topmodels
Availability using Additional_repositories specification:
topmodels yes https://R-Forge.R-project.org
Found the following (possibly) invalid URLs:
URL: http://highstat.com/index.php/mixed-effects-models-and-extensions-in-ecology-with-r (moved to https://www.highstat.com/index.php/mixed-effects-models-and-extensions-in-ecology-with-r)
From: man/CodParasites.Rd
Status: 404
Message: Not Found
The Date field is over a month old.
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘countreg’ can be installed ... [5s/5s] OK
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
Non-standard file/directory found at top level:
‘README.qmd’
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... [0s/0s] OK
* checking whether the package can be loaded with stated dependencies ... [0s/0s] OK
* checking whether the package can be unloaded cleanly ... [0s/0s] OK
* checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK
* checking whether the namespace can be unloaded cleanly ... [0s/0s] OK
* checking loading without being on the library search path ... [0s/0s] OK
* checking whether startup messages can be suppressed ... [0s/0s] OK
* checking use of S3 registration ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... [10s/10s] NOTE
predict.hurdle: no visible global function definition for
‘HurdleBinomial’
predict.hurdle: no visible global function definition for ‘ZTBinomial’
predict.zeroinfl: no visible global function definition for
‘ZIBinomial’
predict.zeroinfl: no visible global function definition for
‘ZTBinomial’
Undefined global functions or variables:
HurdleBinomial ZIBinomial ZTBinomial
* checking Rd files ... [0s/0s] OK
* checking Rd metadata ... OK
* checking Rd line widths ... NOTE
Rd file 'predict.hurdle.Rd':
\usage lines wider than 90 characters:
type = c("mean", "variance", "quantile", "probability", "density", "loglikelihood", "parameters", "distribution"),
Rd file 'predict.zeroinfl.Rd':
\usage lines wider than 90 characters:
type = c("mean", "variance", "quantile", "probability", "density", "loglikelihood", "parameters", "distribution"),
These lines will be truncated in the PDF manual.
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... [0s/0s] OK
* checking data for ASCII and uncompressed saves ... OK
* checking sizes of PDF files under ‘inst/doc’ ... WARNING
‘gs+qpdf’ made some significant size reductions:
compacted ‘countreg.pdf’ from 582Kb to 250Kb
consider running tools::compactPDF(gs_quality = "ebook") on these files,
or build the source package with --compact-vignettes=both
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... [24s/26s] NOTE
Examples with CPU (user + system) or elapsed time > 5s
user system elapsed
CodParasites 7.425 0.179 8.005
* checking differences from ‘countreg-Ex.Rout’ to ‘countreg-Ex.Rout.save’ ... OK
70,88c70,74
< > if(require("topmodels")) {
< + par(mfrow = c(2, 2))
< + rootogram(cp_p, max = 50, main = "Poisson")
< + rootogram(cp_nb, max = 50, main = "Negative Binomial")
< + rootogram(cp_hp, max = 50, main = "Hurdle Poisson")
< + rootogram(cp_hnb, max = 50, main = "Hurdle Negative Binomial")
< + }
< Warning in plot.window(...) : "max" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) : "max" is not a graphical parameter
< Warning in title(...) : "max" is not a graphical parameter
< Warning in plot.window(...) : "max" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) : "max" is not a graphical parameter
< Warning in title(...) : "max" is not a graphical parameter
< Warning in plot.window(...) : "max" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) : "max" is not a graphical parameter
< Warning in title(...) : "max" is not a graphical parameter
< Warning in plot.window(...) : "max" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) : "max" is not a graphical parameter
< Warning in title(...) : "max" is not a graphical parameter
---
> > par(mfrow = c(2, 2))
> > rootogram(cp_p, max = 50, main = "Poisson")
> > rootogram(cp_nb, max = 50, main = "Negative Binomial")
> > rootogram(cp_hp, max = 50, main = "Hurdle Poisson")
> > rootogram(cp_hnb, max = 50, main = "Hurdle Negative Binomial")
94,96d79
<
< detaching 'package:topmodels'
<
164,170c147,151
< > if(require("topmodels")) {
< + par(mfrow = c(2, 2))
< + r_p <- rootogram(cs_p, xlim = c(0, 15), main = "Poisson")
< + r_nb <- rootogram(cs_nb, xlim = c(0, 15), main = "Negative Binomial")
< + r_hp <- rootogram(cs_hp, xlim = c(0, 15), main = "Hurdle Poisson")
< + r_hnb <- rootogram(cs_hnb, xlim = c(0, 15), main = "Hurdle Negative Binomial")
< + }
---
> > par(mfrow = c(2, 2))
> > r_p <- rootogram(cs_p, max = 15, main = "Poisson")
> > r_nb <- rootogram(cs_nb, max = 15, main = "Negative Binomial")
> > r_hp <- rootogram(cs_hp, max = 15, main = "Hurdle Poisson")
> > r_hnb <- rootogram(cs_hnb, max = 15, main = "Hurdle Negative Binomial")
187,205c168,171
< > if(require("topmodels")) {
< + par(mfrow= c(3, 2))
< + qqrplot(cs_p, range = c(0.05, 0.95), main = "Q-Q residuals plot: Poisson")
< + qqrplot(cs_hnb, range = c(0.05, 0.95), main = "Q-Q residuals plot: Hurdle NB")
< + } else {
< + par(mfrow= c(2, 2))
< + }
< Warning in plot.window(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) :
< "range" is not a graphical parameter
< Warning in title(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy.coords(x, y), type = type, ...) :
< "range" is not a graphical parameter
< Warning in plot.window(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) :
< "range" is not a graphical parameter
< Warning in title(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy.coords(x, y), type = type, ...) :
< "range" is not a graphical parameter
---
> > par(mfrow= c(3, 2))
> >
> > qqrplot(cs_p, range = c(0.05, 0.95), main = "Q-Q residuals plot: Poisson")
> > qqrplot(cs_hnb, range = c(0.05, 0.95), main = "Q-Q residuals plot: Hurdle NB")
232,234d197
<
< detaching 'package:topmodels'
<
268c231
< + nbreg(y ~ x, data = d, theta = 1, weights = posterior(fm1)[,i]))
---
> + glm(y ~ x, data = d, family = negative.binomial(1), weights = posterior(fm1)[,i]))
270c233
< + nbreg(y ~ x, data = d, weights = posterior(fm0)[,i]))
---
> + glm.nb(y ~ x, data = d, weights = posterior(fm0)[,i]))
273d235
< + if(require("topmodels")) {
283,285c245
< + plot(r01)
< + plot(r02)
< + }
---
> + plot(r01 + r02)
337c297
< > ##D nbreg(visits ~ ., data = nmes, weights = posterior(nmes_fnb)[,i]))
---
> > ##D glm.nb(visits ~ ., data = nmes, weights = posterior(nmes_fnb)[,i]))
339,344c299,306
< > ##D par(mfrow = c(1, 3))
< > ##D rootogram(nmes_nb, main = "Negative Binomial", xlim = c(0, 50), ylim = c(-1, 25))
< > ##D rootogram(nmes_fnb_rf[[1]], main = "Mixture Negative Binomial (Component 1)",
< > ##D xlim = c(0, 50), ylim = c(-1, 25))
< > ##D rootogram(nmes_fnb_rf[[2]], main = "Mixture Negative Binomial (Component 2)",
< > ##D xlim = c(0, 50), ylim = c(-1, 25))
---
> > ##D r1 <- rootogram(nmes_fnb_rf[[1]], max = 50, plot = FALSE)
> > ##D r2 <- rootogram(nmes_fnb_rf[[2]], max = 50, plot = FALSE)
> > ##D
> > ##D par(mfrow = c(2, 2))
> > ##D rootogram(nmes_nb, max = 50, main = "Negative Binomial", ylim = c(-1, 25))
> > ##D plot(r1 + r2, xlab = "visits", main = "Mixture Negative Binomial", ylim = c(-1, 25))
> > ##D plot(r1, main = "Mixture Negative Binomial (Component 1)", ylim = c(-1, 25))
> > ##D plot(r2, main = "Mixture Negative Binomial (Component 2)", ylim = c(-1, 25))
353c315
< detaching 'package:topmodels', 'package:flexmix', 'package:lattice'
---
> detaching 'package:flexmix', 'package:lattice'
543,544c505,506
< This is nonnest2 0.5-7.
< nonnest2 has not been tested with all combinations of supported model classes.
---
> This is nonnest2 0.5-5.
> nonnest2 has not been tested with all combinations of model classes.
679,681c641,642
< > if(require("topmodels")) {
< + par(mfrow = c(2, 2))
< + rootogram(lm(OralHealthNL$dmfs ~ 1),
---
> > par(mfrow = c(2, 2))
> > rootogram(OralHealthNL$dmfs, "normal",
685c646
< + rootogram(hnb,
---
> > rootogram(hnb,
689c650
< + rootogram(lm(OralHealthNL$dmfs ~ 1),
---
> > rootogram(OralHealthNL$dmfs, "normal",
692,693c653,654
< + abline(h = c(-1, 1), lty = 2)
< + rootogram(hnb,
---
> > abline(h = c(-1, 1), lty = 2)
> > rootogram(hnb,
696,698c657,658
< + abline(h = c(-1, 1), lty = 2)
< + par(mfrow = c(1, 1))
< + }
---
> > abline(h = c(-1, 1), lty = 2)
> > par(mfrow = c(1, 1))
702,703c662,663
< + ZINB = sum(predict(zinb, type = "density", at = 0)),
< + Hurdle = sum(predict(hnb, type = "density", at = 0)))
---
> + ZINB = sum(predict(zinb, type = "prob")[,1]),
> + Hurdle = sum(predict(hnb, type = "prob")[,1]))
743,744c703,704
< detaching 'package:brglm2', 'package:topmodels', 'package:nonnest2',
< 'package:lmtest', 'package:zoo'
---
> detaching 'package:brglm2', 'package:nonnest2', 'package:lmtest',
> 'package:zoo'
745a706,733
> > nameEx("SerumPotassium")
> > ### * SerumPotassium
> >
> > flush(stderr()); flush(stdout())
> >
> > ### Name: SerumPotassium
> > ### Title: Serum Potassium Levels
> > ### Aliases: SerumPotassium
> > ### Keywords: datasets
> >
> > ### ** Examples
> >
> > data("SerumPotassium", package = "countreg")
> >
> > ## Figure 9.3a-c from Rice (2007), and actual hanging rootogram
> > ## (note that Rice erroneously refers to suspended rootograms as hanging)
> > br <- 32:54/10 - 0.05
> > rootogram(SerumPotassium, "normal", scale = "raw", style = "standing",
> + breaks = br, col = "transparent")
> > rootogram(SerumPotassium, "normal", scale = "raw", style = "suspended",
> + breaks = br, col = "transparent", ylim = c(2.8, -4))
> > rootogram(SerumPotassium, "normal", scale = "sqrt", style = "suspended",
> + breaks = br, col = "transparent", ylim = c(1, -1.5))
> > rootogram(SerumPotassium, "normal", breaks = br)
> >
> >
> >
> > cleanEx()
768a757,760
> Deviance Residuals:
> Min 1Q Median 3Q Max
> -2.27187 -0.55501 -0.06922 0.28720 2.39771
>
821,830c813,814
< > if(require("topmodels")) {
< + rootogram(tb_p)
< + qqrplot(tb_p, range = c(0.05, 0.95))
< + }
< Warning in plot.window(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) :
< "range" is not a graphical parameter
< Warning in title(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy.coords(x, y), type = type, ...) :
< "range" is not a graphical parameter
---
> > rootogram(tb_p)
> > qqrplot(tb_p, range = c(0.05, 0.95))
849,858c833,871
< > if(require("topmodels")) {
< + rootogram(tb_hp)
< + qqrplot(tb_hp, range = c(0.05, 0.95))
< + }
< Warning in plot.window(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy, type, ...) :
< "range" is not a graphical parameter
< Warning in title(...) : "range" is not a graphical parameter
< Warning in plot.xy(xy.coords(x, y), type = type, ...) :
< "range" is not a graphical parameter
---
> > rootogram(tb_hp)
> > qqrplot(tb_hp, range = c(0.05, 0.95))
> >
> >
> >
> >
> > cleanEx()
> > nameEx("VolcanoHeights")
> > ### * VolcanoHeights
> >
> > flush(stderr()); flush(stdout())
> >
> > ### Name: VolcanoHeights
> > ### Title: Tukey's Volcano Heights
> > ### Aliases: VolcanoHeights
> > ### Keywords: datasets
> >
> > ### ** Examples
> >
> > ## Rootograms from Tukey (1972)
> > ## (some 'breaks' don't match exactly)
> > data("VolcanoHeights", package = "countreg")
> >
> > ## Figure 16
> > rootogram(VolcanoHeights, "normal", style = "standing",
> + breaks = 0:20 - 0.01, col = "transparent")
> >
> > ## Figure 17
> > rootogram(sqrt(1000 * VolcanoHeights), "normal", style = "standing",
> + breaks = 0:17 * 10 - 1.1, col = "transparent")
> >
> > ## Figure 18
> > rootogram(sqrt(1000 * VolcanoHeights), "normal", style = "hanging",
> + breaks = -2:18 * 10 - 1.1)
> >
> > ## Figure 19
> > rootogram(sqrt(1000 * VolcanoHeights), "normal", style = "suspended",
> + breaks = -2:18 * 10 - 1.1, ylim = c(6, -2))
> > abline(h = c(-1.5, -1, 1, 1.5), lty = c(2, 3, 3, 2))
863,865d875
<
< detaching 'package:topmodels'
<
1228,1229c1238,1239
< > nameEx("nbreg")
< > ### * nbreg
---
> > nameEx("pit")
> > ### * pit
1233,1235c1243,1245
< > ### Name: nbreg
< > ### Title: Negative Binomial Count Data Regression
< > ### Aliases: nbreg print.nbreg
---
> > ### Name: pit
> > ### Title: Probability Integral Transform (PIT)
> > ### Aliases: pit pit.default pit.glm pit.hurdle pit.zeroinfl pit.zerotrunc
1239a1250
> > ## count data regression models: crab satellites
1241,1274c1252,1259
< >
< > ## NB2
< > fm_nb2 <- nbreg(satellites ~ width + color, data = CrabSatellites)
< >
< > ## NB1
< > fm_nb1 <- nbreg(satellites ~ width + color, data = CrabSatellites, dist = "NB1")
< >
< > ## NBH
< > fm_nbh <- nbreg(satellites ~ width + color | weight, data = CrabSatellites)
< >
< > ## NB1 with variable theta
< > fm_nb1h <- nbreg(satellites ~ width + color | weight, data = CrabSatellites,
< + dist = "NB1")
< >
< > ## Example not run:
< > ## data
< > # data("GSOEP", package = "countreg")
< > # gsoep <- subset(GSOEP, year == "1984")
< >
< > ## NB2
< > # fm_nb2 <- nbreg(docvis ~ educ + public + addon,
< > # data = gsoep)
< >
< > ## NB1
< > # fm_nb1 <- nbreg(docvis ~ educ + public + addon,
< > # data = gsoep, dist = "NB1")
< >
< > ## NBH
< > # fm_nbh <- nbreg(docvis ~ educ + public + addon | married + public,
< > # data = gsoep)
< >
< > ## NB1 with variable theta
< > # fm_nb1h <- nbreg(docvis ~ educ + public + addon | married + public,
< > # data = gsoep, dist = "NB1")
---
> > cs_p <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson)
> > pit(cs_p)[1:5,]
> [,1] [,2]
> 1 0.9511145 0.97975528
> 2 0.8158450 0.92556681
> 3 0.0000000 0.12378915
> 4 0.0000000 0.35361066
> 5 0.0122986 0.06639115
1279,1280c1264,1265
< > nameEx("nbreg.control")
< > ### * nbreg.control
---
> > nameEx("pithist")
> > ### * pithist
1284,1287c1269,1273
< > ### Name: nbreg.control
< > ### Title: Control Parameters for Negative Binomial Count Data Regression
< > ### Aliases: nbreg.control
< > ### Keywords: regression
---
> > ### Name: pithist
> > ### Title: PIT Histograms for Assessing Goodness of Fit of Probability
> > ### Models
> > ### Aliases: pithist
> > ### Keywords: hplot
1290a1277
> > ## count data regression models: crab satellites
1291a1279,1280
> > cs_p <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson)
> > cs_hnb <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "negbin")
1293,1294c1282,1286
< > ## default start values
< > fm1 <- nbreg(satellites ~ width + as.numeric(color), data = CrabSatellites)
---
> > ## PIT histograms
> > par(mfrow = c(1, 2))
> > pithist(cs_p, ylim = c(0, 4.2))
> > pithist(cs_hnb, ylim = c(0, 4.2))
> > par(mfrow = c(1, 1))
1296,1298d1287
< > ## user-supplied start values
< > fm2 <- nbreg(satellites ~ width + as.numeric(color), data = CrabSatellites,
< + start = list(mu = c(0, 0, 0), theta = c(0.5)))
1301a1291
> > graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1351c1341
< > ### fitted.hurdle extractAIC.hurdle
---
> > ### fitted.hurdle predprob.hurdle extractAIC.hurdle
1400,1457d1389
< > nameEx("predict.nbreg")
< > ### * predict.nbreg
< >
< > flush(stderr()); flush(stdout())
< >
< > ### Name: predict.nbreg
< > ### Title: Methods for nbreg Objects
< > ### Aliases: predict.nbreg residuals.nbreg terms.nbreg model.frame.nbreg
< > ### model.matrix.nbreg coef.nbreg vcov.nbreg summary.nbreg
< > ### getSummary.nbreg print.summary.nbreg logLik.nbreg nobs.nbreg
< > ### fitted.nbreg extractAIC.nbreg
< > ### Keywords: regression
< >
< > ### ** Examples
< >
< > data("CrabSatellites", package = "countreg")
< > fm <- nbreg(satellites ~ width + color, data = CrabSatellites)
< >
< > plot(residuals(fm, type = "pearson") ~ fitted(fm))
< >
< > coef(fm)
< mu_(Intercept) mu_width mu_color.L mu_color.Q
< -3.68546352 0.17839042 -0.41422641 0.13011660
< mu_color.C theta_(Intercept)
< 0.04408676 -0.07031756
< > summary(fm)
<
< Call:
< nbreg(formula = satellites ~ width + color, data = CrabSatellites)
<
< Pearson residuals:
< Min 1Q Median 3Q Max
< -0.8886 -0.7714 -0.2416 0.5114 4.2830
<
< Coefficients (NB2 with log link):
< Estimate Std. Error z value Pr(>|z|)
< (Intercept) -3.68546 1.26893 -2.904 0.003680 **
< width 0.17839 0.04807 3.711 0.000206 ***
< color.L -0.41423 0.29429 -1.408 0.159266
< color.Q 0.13012 0.24244 0.537 0.591484
< color.C 0.04409 0.17887 0.246 0.805320
< ---
< Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
<
< Theta coefficients (log link):
< Estimate Std. Error z value Pr(>|z|)
< (Intercept) -0.07032 0.18028 -0.39 0.697
<
< Number of iterations in BFGS optimization: 11
< Log-likelihood: -374.3 on 6 Df
< > logLik(fm)
< 'log Lik.' -374.2979 (df=6)
< > AIC(fm)
< [1] 760.5958
< >
< >
< >
< > cleanEx()
1468c1400
< > ### fitted.zeroinfl extractAIC.zeroinfl
---
> > ### fitted.zeroinfl predprob.zeroinfl extractAIC.zeroinfl
1529c1461,1462
< > ### fitted.zerotrunc extractAIC.zerotrunc getSummary.zerotrunc
---
> > ### fitted.zerotrunc predprob.zerotrunc extractAIC.zerotrunc
> > ### getSummary.zerotrunc
1572a1506,1689
> > nameEx("qqrplot")
> > ### * qqrplot
> >
> > flush(stderr()); flush(stdout())
> >
> > ### Name: qqrplot
> > ### Title: Q-Q Plots for Quantile Residuals
> > ### Aliases: qqrplot
> > ### Keywords: hplot
> >
> > ### ** Examples
> >
> > ## count data regression models: crab satellites
> > data("CrabSatellites", package = "countreg")
> > cs_p <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson)
> > cs_nb <- glm.nb(satellites ~ width + color, data = CrabSatellites)
> > cs_hp <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "poisson")
> > cs_hnb <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "negbin")
> >
> > ## Q-Q residual plots
> > par(mfrow = c(2, 2))
> > qqrplot(cs_p, main = "Poisson")
> > qqrplot(cs_nb, main = "Negative Binomial")
> > qqrplot(cs_hp, main = "Hurdle Poisson")
> > qqrplot(cs_hnb, main = "Hurdle Negative Binomial")
> > par(mfrow = c(1, 1))
> >
> > ## Q-Q residual plots
> > par(mfrow = c(2, 2))
> > qqrplot(cs_p, main = "One Random Sample")
> > qqrplot(cs_p, main = "Median", type = "quantile")
> > qqrplot(cs_p, main = "10 Random Samples and Range", nsim = 10, range = c(0.005, 0.995))
> > qqrplot(cs_p, main = "100 Random Samples", nsim = 100, pch = 19, col = gray(0, alpha = 0.01))
> > par(mfrow = c(1, 1))
> >
> >
> >
> >
> > graphics::par(get("par.postscript", pos = 'CheckExEnv'))
> > cleanEx()
> > nameEx("qresiduals")
> > ### * qresiduals
> >
> > flush(stderr()); flush(stdout())
> >
> > ### Name: qresiduals
> > ### Title: (Randomized) Quantile Residuals
> > ### Aliases: qresiduals qresiduals.default
> > ### Keywords: regression
> >
> > ### ** Examples
> >
> > ## count data regression models: crab satellites
> > data("CrabSatellites", package = "countreg")
> > cs_p <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson)
> >
> > qres <- cbind(
> + sample = qresiduals(cs_p, nsim = 3),
> + median = qresiduals(cs_p, type = "quantile"),
> + mean100 = rowMeans(qresiduals(cs_p, nsim = 100)),
> + range = qresiduals(cs_p, type = "quantile", prob = c(0, 1))
> + )
> > qres[1:5, ]
> r_1 r_2 r_3 median mean100 q_0 q_1
> 1 1.736009 1.7783079 1.8061715 1.8175679 1.832230 1.6557574 2.0487206
> 2 1.065500 1.0695697 0.9728868 1.1297344 1.136869 0.8996436 1.4435472
> 3 -1.469025 -1.2220391 -1.6880413 -1.5390620 -1.592488 -Inf -1.1562515
> 4 -0.464480 -0.7459894 -0.6541393 -0.9276086 -1.161948 -Inf -0.3755906
> 5 -1.991589 -1.6221517 -1.7672206 -1.7583396 -1.797331 -2.2476707 -1.5032201
> >
> >
> >
> > cleanEx()
> > nameEx("rootogram")
> > ### * rootogram
> >
> > flush(stderr()); flush(stdout())
> >
> > ### Name: rootogram
> > ### Title: Rootograms for Assessing Goodness of Fit of Probability Models
> > ### Aliases: rootogram plot.rootogram autoplot.rootogram +.rootogram
> > ### c.rootogram rbind.rootogram rootogram.default rootogram.gam
> > ### rootogram.gamlss rootogram.glm rootogram.hurdle rootogram.numeric
> > ### rootogram.zeroinfl rootogram.zerotrunc
> > ### Keywords: hplot
> >
> > ### ** Examples
> >
> > ## different interfaces
> >
> > ## number of deaths by horsekicks in Prussian army (Von Bortkiewicz 1898)
> > deaths <- rep(0:4, c(109, 65, 22, 3, 1))
> >
> > ## default method: fitted values "by hand"
> > rootogram(table(deaths), fitted = length(deaths) * dpois(0:4, mean(deaths)))
> >
> > ## numeric method: fitted values via fitdistr()
> > rootogram(deaths, fitted = "poisson")
> > rootogram(deaths, fitted = dpois, start = list(lambda = 1),
> + breaks = 0:5 - 0.5, width = 0.9)
> >
> > ## glm method: fitted values via glm()
> > m <- glm(deaths ~ 1, family = poisson)
> > rootogram(m)
> >
> > ## inspect output (without plotting)
> > r <- rootogram(m, plot = FALSE)
> > r
> observed expected x y width height line
> 1 109 108.6701738 0 -0.01580778 0.9 10.440307 10.4244987
> 2 65 66.2888061 1 0.07953604 0.9 8.062258 8.1417938
> 3 22 20.2180859 2 -0.19396317 0.9 4.690416 4.4964526
> 4 3 4.1110108 3 0.29551196 0.9 1.732051 2.0275628
> 5 1 0.6269291 4 -0.20821143 0.9 1.000000 0.7917886
> >
> > ## create ggplot2 version
> > if(require("ggplot2")) autoplot(r)
> >
> > #-------------------------------------------------------------------------------
> >
> > ## different styles
> >
> > ## artificial data from negative binomial (mu = 3, theta = 2)
> > ## and Poisson (mu = 3) distribution
> > set.seed(1090)
> > y <- rnbinom(100, mu = 3, size = 2)
> > x <- rpois(100, lambda = 3)
> >
> > ## correctly specified Poisson model fit (mu = 3.34)
> > par(mfrow = c(2, 3))
> > rootogram(x, "poisson", style = "standing", ylim = c(-2.2, 4.8), main = "Standing")
> > rootogram(x, "poisson", style = "hanging", ylim = c(-2.2, 4.8), main = "Hanging")
> > rootogram(x, "poisson", style = "suspended", ylim = c(-2.2, 4.8), main = "Suspended")
> >
> > ## misspecified Poisson model fit (mu = 3.32)
> > rootogram(y, "poisson", style = "standing", ylim = c(-2.2, 4.8), main = "Standing")
> > rootogram(y, "poisson", style = "hanging", ylim = c(-2.2, 4.8), main = "Hanging")
> > rootogram(y, "poisson", style = "suspended", ylim = c(-2.2, 4.8), main = "Suspended")
> > par(mfrow = c(1, 1))
> >
> > #-------------------------------------------------------------------------------
> >
> > ## artificial data from a t_4 distribution
> > set.seed(1090)
> > y <- rt(1000, 4)
> >
> > ## incorrect normal fit (tails too light) and correct t fit
> > par(mfrow = c(1, 2))
> > rootogram(y, fitted = "normal", breaks = 40, xlim = c(-6, 6), ylim = c(-2, 14))
> > rootogram(y, fitted = "t", breaks = 40, xlim = c(-6, 6), ylim = c(-2, 14))
> > par(mfrow = c(1, 1))
> >
> > #-------------------------------------------------------------------------------
> >
> > ## linear regression with normal/Gaussian response: anorexia data
> > an <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
> > rootogram(an, ylim = c(-1, 4))
> > abline(h = c(-1, 1), col = "#1E55CE", lty = 2, lwd = 2)
> >
> > #-------------------------------------------------------------------------------
> >
> > ## count data regression models: crab satellites
> > data("CrabSatellites", package = "countreg")
> > cs_p <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson)
> > cs_nb <- glm.nb(satellites ~ width + color, data = CrabSatellites)
> > cs_hp <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "poisson")
> > cs_hnb <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "negbin")
> >
> > ## rootograms
> > par(mfrow = c(2, 2))
> > rootogram(cs_p, max = 15, main = "Poisson")
> > rootogram(cs_nb, max = 15, main = "Negative Binomial")
> > rootogram(cs_hp, max = 15, main = "Hurdle Poisson")
> > rootogram(cs_hnb, max = 15, main = "Hurdle Negative Binomial")
> > par(mfrow = c(1, 1))
> >
> >
> >
> >
> > graphics::par(get("par.postscript", pos = 'CheckExEnv'))
> > cleanEx()
>
> detaching 'package:ggplot2'
>
1785a1903,1906
>
> Deviance Residuals:
> Min 1Q Median 3Q Max
> -2.5409 -0.9350 -0.2051 0.6278 3.7722
* checking examples with --run-donttest ... [46s/35s] OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
Running ‘tinytest.R’ [2s/2s]
[2s/2s] OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ...
‘countreg.Rnw’... [3s/3s] NOTE
differences from ‘countreg.Rout.save’
91a92,95
> Deviance Residuals:
> Min 1Q Median 3Q Max
> -6.2816 -2.0370 -0.7143 0.7301 16.2655
>
257c261
< no.\ parameters & 7 & 7 & 8 & 8 & 13 & 13 \\
---
> no.\ parameters & 7 & 7 & 7 & 8 & 13 & 13 \\
309c313
< Df 7 8 8 13 13
---
> Df 7 7 8 13 13
[3s/3s] NOTE
* checking re-building of vignette outputs ... [9s/9s] OK
* checking PDF version of manual ... [6s/6s] OK
* checking HTML version of manual ... [2s/2s] OK
* checking for non-standard things in the check directory ... OK
* checking for detritus in the temp directory ... OK
* DONE
Status: 1 WARNING, 6 NOTEs
See
‘/srv/rf/building/build_2024-08-05-16-44/RF_PKG_CHECK/PKGS/countreg.Rcheck/00check.log’
for details.
Run time: 199.98 seconds.