Skip to content

Commit a56d010

Browse files
committed
fix merge
2 parents 9a8e5e8 + 8504463 commit a56d010

File tree

412 files changed

+34910
-5462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+34910
-5462
lines changed

DESCRIPTION

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: vcdExtra
22
Type: Package
33
Title: 'vcd' Extensions and Additions
4-
Version: 0.8-7
5-
Date: 2025-11-18
4+
Version: 0.8.7
5+
Date: 2025-12-10
66
Language: en-US
77
Authors@R: c(
88
person(given = "Michael",
@@ -29,7 +29,7 @@ Authors@R: c(
2929
person(given = "Daniel", family = "Sabanes Bove", role="ctb")
3030
)
3131
Maintainer: Michael Friendly <[email protected]>
32-
Depends: R (>= 3.5.0), vcd, gnm (>= 1.0-3), grid
32+
Depends: R (>= 3.5.0), vcd, gnm (>= 1.0-3)
3333
Suggests:
3434
gmodels,
3535
Fahrmeir,
@@ -58,11 +58,12 @@ Suggests:
5858
readxl,
5959
stringr,
6060
tidyr (>= 1.3.0)
61-
Imports:
62-
MASS,
63-
grDevices,
64-
stats,
65-
utils,
61+
Imports:
62+
MASS,
63+
grDevices,
64+
grid,
65+
stats,
66+
utils,
6667
ca,
6768
rgl
6869
Description: Provides additional data sets, methods and documentation to complement the 'vcd' package for Visualizing Categorical Data
@@ -80,3 +81,4 @@ LazyData: yes
8081
Encoding: UTF-8
8182
Config/testthat/edition: 3
8283
RoxygenNote: 7.3.3
84+
Roxygen: list(markdown = TRUE)

NEWS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
## Version 0.8.7 (2025-11-18)
1+
## Version 0.8.7 (2025-12-10)
22

33
This is a major release of the package, fixing bugs and revising documentation
44

55
o Added tests for CMHtest() PR #13 [Thx: Daniel Sabanes Bove]
66
o Automatically omit strata with a single observation in CMHtest() because they do not contribute to the test statistics
77
o Use the generalized Moore-Penrose inverse from MASS in CMHtest() such that it can work when the variance
88
matrix is singular.
9-
o Converted the package to use roxygen documentation.
9+
o Converted the package to use roxygen documentation via {rd2roxygen}. UGH!
1010
o Added `CrabSatellites` data from {countreg} b/c that's still not available on CRAN
11+
o Moved `grid` from `Depends:` to `Imports:`
12+
o Now use markdown in package documentation for easier maintenance, via {roxygen2md}
1113

1214
## Version 0.8-6 (2025-07-23)
1315

R/CMHtest.R

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
# DONE: With strata, calculate overall CMH tests controlling for strata
1818
# FIXED: rmeans and cmeans tests were labeled incorrectly
1919

20-
21-
2220
#' Generalized Cochran-Mantel-Haenszel Tests
2321
#'
2422
#' Provides generalized Cochran-Mantel-Haenszel tests of association of two
2523
#' possibly ordered factors, optionally stratified other factor(s). With
26-
#' strata, \code{CMHtest} calculates these tests for each level of the
24+
#' strata, `CMHtest` calculates these tests for each level of the
2725
#' stratifying variables and also provides overall tests controlling for the
2826
#' strata.
2927
#'
@@ -41,29 +39,29 @@
4139
#' The CMH analysis for a two-way table produces generalized
4240
#' Cochran-Mantel-Haenszel statistics (Landis etal., 1978).
4341
#'
44-
#' These include the CMH \bold{correlation} statistic (\code{"cor"}), treating
42+
#' These include the CMH **correlation** statistic (`"cor"`), treating
4543
#' both factors as ordered. For a given statum, with equally spaced row and
4644
#' column scores, this CMH statistic reduces to \eqn{(n-1) r^2}, where \eqn{r}
47-
#' is the Pearson correlation between X and Y. With \code{"midrank"} scores,
45+
#' is the Pearson correlation between X and Y. With `"midrank"` scores,
4846
#' this CMH statistic is analogous to \eqn{(n-1) r_S^2}, using the Spearman
4947
#' rank correlation.
5048
#'
51-
#' The \bold{ANOVA} (row mean scores and column mean scores) statistics, treat
49+
#' The **ANOVA** (row mean scores and column mean scores) statistics, treat
5250
#' the columns and rows respectively as ordinal, and are sensitive to mean
5351
#' shifts over columns or rows. These are transforms of the \eqn{F} statistics
5452
#' from one-way ANOVAs with equally spaced scores and to Kruskal-Wallis tests
55-
#' with \code{"midrank"} scores.
53+
#' with `"midrank"` scores.
5654
#'
57-
#' The CMH \bold{general} association statistic treat both factors as
55+
#' The CMH **general** association statistic treat both factors as
5856
#' unordered, and give a test closely related to the Pearson \eqn{\chi^2} test.
5957
#' When there is more than one stratum, the overall general CMH statistic gives
6058
#' a stratum-adjusted Pearson \eqn{\chi^2}, equivalent to what is calculated by
6159
#' \code{\link[stats]{mantelhaen.test}}.
6260
#'
6361
#' For a 3+ way table, one table of CMH tests is produced for each combination
64-
#' of the factors identified as \code{strata}. If \code{overall=TRUE}, an
62+
#' of the factors identified as `strata`. If `overall=TRUE`, an
6563
#' additional table is calculated for the same two primary variables,
66-
#' controlling for (pooling over) the \code{strata} variables.
64+
#' controlling for (pooling over) the `strata` variables.
6765
#'
6866
#' These overall tests implicitly assume no interactions between the primary
6967
#' variables and the strata and they will have low power in the presence of
@@ -73,41 +71,42 @@
7371
#' observations) are automatically omitted from the analysis.
7472
#'
7573
#' @aliases CMHtest CMHtest.formula CMHtest.default Cochran Mantel Haenszel test print.CMHtest
76-
#' @param x A 2+ way contingency table in array form, or a class \code{"table"}
74+
#' @param x A 2+ way contingency table in array form, or a class `"table"`
7775
#' object with optional category labels specified in the dimnames(x) attribute.
7876
#' @param formula a formula specifying the variables used to create a
79-
#' contingency table from \code{data}. This should be a one-sided formula when
80-
#' \code{data} is in array form, and a two-sided formula with a response
81-
#' \code{Freq} if \code{data} is a data frame with a cell frequency variable.
77+
#' contingency table from `data`. This should be a one-sided formula when
78+
#' `data` is in array form, and a two-sided formula with a response
79+
#' `Freq` if `data` is a data frame with a cell frequency variable.
8280
#' For convenience, conditioning formulas can be specified indicating strata.
83-
#' @param data either a data frame, or an object of class \code{"table"} or \code{"ftable"}.
81+
#' @param data either a data frame, or an object of class `"table"` or `"ftable"`.
8482
#' @param subset an optional vector specifying a subset of observations to be used.
85-
#' @param na.action a function which indicates what should happen when the data contain \code{NA}s. Ignored if \code{data} is a contingency table
83+
#' @param na.action a function which indicates what should happen when the data contain `NA`s.
84+
#' Ignored if `data` is a contingency table.
8685
#' @param strata For a 3- or higher-way table, the names or numbers of the
8786
#' factors to be treated as strata. By default, the first 2 factors are
8887
#' treated as the main table variables, and all others considered stratifying factors.
8988
#' @param rscores Row scores. Either a set of numbers (typically integers,
90-
#' \code{1:R}) or the string \code{"midrank"} for standardized midrank scores,
91-
#' or \code{NULL} to exclude tests that depend on row scores.
89+
#' `1:R`) or the string `"midrank"` for standardized midrank scores,
90+
#' or `NULL` to exclude tests that depend on row scores.
9291
#' @param cscores Column scores. Same as for row scores.
93-
#' @param types Types of CMH tests to compute: Any one or more of \code{c("cor", "cmeans", "rmeans", "general")}, or
94-
#' \code{"ALL"} for all of these.
92+
#' @param types Types of CMH tests to compute: Any one or more of `c("cor", "cmeans", "rmeans", "general")`, or
93+
#' `"ALL"` for all of these.
9594
#' @param overall logical. Whether to calculate overall tests, controlling for the stratifying factors.
9695
#' @param details logical. Whether to include computational details in the result
9796
#' @param \dots Other arguments passed to default method.
9897
#' @param digits Digits to print.
9998
#'
100-
#' @return An object of class \code{"CMHtest"} , a list with the following 4 components:
99+
#' @return An object of class `"CMHtest"` , a list with the following 4 components:
101100
#'
102-
#' \item{table}{A matrix containing the test statistics, with columns \code{Chisq}, \code{Df} and \code{Prob} }
101+
#' \item{table}{A matrix containing the test statistics, with columns `Chisq`, `Df` and `Prob` }
103102
#' \item{names}{The names of the table row and column variables}
104103
#' \item{rscore}{Row scores}
105104
#' \item{cscore}{Column scores}
106105
#'
107-
#' If \code{details==TRUE}, additional components are included.
106+
#' If `details==TRUE`, additional components are included.
108107
#'
109-
#' If there are strata, the result is a list of \code{"CMHtest"} objects. If
110-
#' \code{overall=TRUE} another component, labeled \code{ALL} is appended to the
108+
#' If there are strata, the result is a list of `"CMHtest"` objects. If
109+
#' `overall=TRUE` another component, labeled `ALL` is appended to the
111110
#' list.
112111
#'
113112
#' @author Michael Friendly
@@ -120,25 +119,25 @@
120119
#' Cochran-Mantel-Haenszel chi-squared test of the null that two nominal
121120
#' variables are conditionally independent in each stratum, assuming that there
122121
#' is no three-way interaction
122+
#' @family association tests
123123
#'
124-
#' @references Stokes, M. E. & Davis, C. S. & Koch, G., (2000).
125-
#' \emph{Categorical Data Analysis using the SAS System}, 2nd Ed., Cary, NC:
124+
#' @references
125+
#' Stokes, M. E. & Davis, C. S. & Koch, G., (2000).
126+
#' *Categorical Data Analysis using the SAS System*, 2nd Ed., Cary, NC:
126127
#' SAS Institute, pp 74-75, 92-101, 124-129. Details of the computation are
127-
#' given at:
128-
#' \url{http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_freq_a0000000648.htm
129-
#' }
128+
#' given at: <http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_freq_a0000000648.htm>
130129
#'
131130
#' Cochran, W. G. (1954), Some Methods for Strengthening the Common
132-
#' \eqn{\chi^2} Tests, \emph{Biometrics}, 10, 417-451.
131+
#' \eqn{\chi^2} Tests, *Biometrics*, 10, 417-451.
133132
#'
134133
#' Landis, R. J., Heyman, E. R., and Koch, G. G. (1978). Average Partial
135134
#' Association in Three-way Contingency Tables: A Review and Discussion of
136-
#' Alternative Tests, \emph{International Statistical Review}, \bold{46},
135+
#' Alternative Tests, *International Statistical Review*, **46**,
137136
#' 237-254.
138137
#'
139138
#' Mantel, N. (1963), Chi-square Tests with One Degree of Freedom: Extensions
140-
#' of the Mantel-Haenszel Procedure," \emph{Journal of the American Statistical
141-
#' Association}, 58, 690-700.
139+
#' of the Mantel-Haenszel Procedure," *Journal of the American Statistical
140+
#' Association*, 58, 690-700.
142141
#' @keywords htest
143142
#' @export
144143
#' @examples

R/CrabSatellites.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#' color, spine condition, weight, and carapace width. Color and spine condition are ordered factors but are treated as numeric in some analyses.
3030

3131
#' @source
32-
#' Table 4.3 in Agresti (2002). This dataset was taken from the \pkg{countreg}, which is not on CRAN
32+
#' Table 4.3 in Agresti (2002). This dataset was taken from the \pkg{countreg} package, which is not on CRAN
3333
#'
3434
#' @references
3535
#' Agresti A (2002). Categorical Data Analysis, 2nd ed., John Wiley & Sons, Hoboken.
@@ -39,9 +39,7 @@
3939
#' Brockmann HJ (1996). “Satellite Male Groups in Horseshoe Crabs, Limulus polyphemus”, Ethology, 102(1), 1–21.
4040
#'
4141
#' @examples
42-
#' # example code
43-
#' ## load data, use ordered factors as numeric, and
44-
#' ## grouped factor version of width
42+
#' ## load data, use ordered factors as numeric, and grouped factor version of width
4543
#' data("CrabSatellites", package = "vcdExtra")
4644
#' CrabSatellites <- transform(CrabSatellites,
4745
#' color = as.numeric(color),

R/Crossings.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#' Crossings Interaction of Factors
22
#'
33
#' Given two ordered factors in a square, n x n frequency table,
4-
#' \code{Crossings} creates an n-1 column matrix corresponding to different
4+
#' `Crossings` creates an n-1 column matrix corresponding to different
55
#' degrees of difficulty in crossing from one level to the next, as described
66
#' by Goodman (1972).
77
#'
88
#'
99
#' @param \dots Two factors
10-
#' @return For two factors of \code{n} levels, returns a binary indicator
11-
#' matrix of \code{n*n} rows and \code{n-1} columns.
10+
#' @return For two factors of `n` levels, returns a binary indicator
11+
#' matrix of `n*n` rows and `n-1` columns.
1212
#' @author Michael Friendly and Heather Turner
1313
#' @seealso
1414
#' \code{\link[stats]{glm}}, \code{\link[gnm]{gnm}} for model fitting
@@ -18,8 +18,8 @@
1818
#'
1919
#' @references
2020
#' Goodman, L. (1972). Some multiplicative models for the analysis
21-
#' of cross-classified data. In: \emph{Proceedings of the Sixth Berkeley
22-
#' Symposium on Mathematical Statistics and Probability}, Berkeley, CA:
21+
#' of cross-classified data. In: *Proceedings of the Sixth Berkeley
22+
#' Symposium on Mathematical Statistics and Probability*, Berkeley, CA:
2323
#' University of California Press, pp. 649-696.
2424
#' @keywords models manip
2525
#' @export

R/GKgamma.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#' @aliases GKgamma print.GKgamma
1515
#' @param x A two-way frequency table, in matrix or table form. The rows and columns are considered to be ordinal factors
1616
#' @param level Confidence level for a significance test of \eqn{\gamma \ne =}{gamma !=0}
17-
#' @return Returns an object of class \code{"GKgamma"} with 6 components, as follows
17+
#' @return Returns an object of class `"GKgamma"` with 6 components, as follows
1818
#' \describe{
1919
#' \item{gamma}{The gamma statistic}
2020
#' \item{C}{Total number of concordant pairs in the table}
@@ -26,16 +26,17 @@
2626
#'
2727
#' @author Michael Friendly; original version by Laura Thompson
2828
#' @seealso \code{\link[vcd]{assocstats}}, \link[vcd]{Kappa}
29-
#' @references Agresti, A. \emph{Categorical Data Analysis}. John Wiley & Sons,
29+
#' @family association tests
30+
#' @references Agresti, A. *Categorical Data Analysis*. John Wiley & Sons,
3031
#' 2002, pp. 57--59.
3132
#'
3233
#' Goodman, L. A., & Kruskal, W. H. (1954). Measures of association for cross
33-
#' classifications. \emph{Journal of the American Statistical Association}, 49,
34+
#' classifications. *Journal of the American Statistical Association*, 49,
3435
#' 732-764.
3536
#'
3637
#' Goodman, L. A., & Kruskal, W. H. (1963). Measures of association for cross
37-
#' classifications III: Approximate sampling theory. \emph{Journal of the
38-
#' American Statistical Association}, 58, 310-364.
38+
#' classifications III: Approximate sampling theory. *Journal of the
39+
#' American Statistical Association*, 58, 310-364.
3940
#' @keywords htest category
4041
#' @examples
4142
#'

R/HLtest.R

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,49 @@
1010

1111
#' Hosmer-Lemeshow Goodness of Fit Test
1212
#'
13-
#' The \code{HLtest} function computes the classical Hosmer-Lemeshow (1980)
14-
#' goodness of fit test for a binomial \code{glm} object in logistic regression
13+
#' The `HLtest` function computes the classical Hosmer-Lemeshow (1980)
14+
#' goodness of fit test for a binomial `glm` object in logistic regression
1515
#'
1616
#' The general idea is to assesses whether or not the observed event rates
1717
#' match expected event rates in subgroups of the model population. The
1818
#' Hosmer-Lemeshow test specifically identifies subgroups as the deciles of
19-
#' fitted event values, or other quantiles as determined by the \code{g}
20-
#' argument. Given these subgroups, a simple chisquare test on \code{g-2} df is
19+
#' fitted event values, or other quantiles as determined by the `g`
20+
#' argument. Given these subgroups, a simple chisquare test on `g-2` df is
2121
#' used.
2222
#'
23-
#' In addition to \code{print} and \code{summary} methods, a \code{plot} method
23+
#' In addition to `print` and `summary` methods, a `plot` method
2424
#' is supplied to visualize the discrepancies between observed and fitted
2525
#' frequencies.
2626
#'
2727
#'
2828
#' @aliases HosmerLemeshow HLtest plot.HLtest print.HLtest rootogram.HLtest
2929
#' summary.HLtest
30-
#' @param model A \code{glm} model object in the \code{binomial} family
30+
#' @param model A `glm` model object in the `binomial` family
3131
#' @param g Number of groups used to partition the fitted values for the GOF
3232
#' test.
33-
#' @param x,object A \code{HLtest} object
33+
#' @param x,object A `HLtest` object
3434
#' @param \dots Other arguments passed down to methods
35-
#' @return A class \code{HLtest} object with the following components:
35+
#' @return A class `HLtest` object with the following components:
3636
#' \item{table}{A data.frame describing the results of partitioning the data
37-
#' into \code{g} groups with the following columns: \code{cut}, \code{total},
38-
#' \code{obs}, \code{exp}, \code{chi}} \item{chisq}{The chisquare statistics}
37+
#' into `g` groups with the following columns: `cut`, `total`,
38+
#' `obs`, `exp`, `chi`} \item{chisq}{The chisquare statistics}
3939
#' \item{df}{Degrees of freedom} \item{p.value}{p value} \item{groups}{Number
40-
#' of groups} \item{call}{\code{model} call} %% ...
40+
#' of groups} \item{call}{`model` call} %% ...
4141
#' @author Michael Friendly
4242
#' @seealso \code{\link[vcd]{rootogram}}, ~~~
43+
#' @family association tests
4344
#' @references
4445
#'
4546
#' Hosmer, David W., Lemeshow, Stanley (1980). A goodness-of-fit test for
46-
#' multiple logistic regression model. \emph{Communications in Statistics,
47-
#' Series A}, 9, 1043-1069.
47+
#' multiple logistic regression model. *Communications in Statistics,
48+
#' Series A*, 9, 1043-1069.
4849
#'
49-
#' Hosmer, David W., Lemeshow, Stanley (2000). \emph{Applied Logistic
50-
#' Regression}, New York: Wiley, ISBN 0-471-61553-6
50+
#' Hosmer, David W., Lemeshow, Stanley (2000). *Applied Logistic
51+
#' Regression*, New York: Wiley, ISBN 0-471-61553-6
5152
#'
5253
#' Lemeshow, S. and Hosmer, D.W. (1982). A review of goodness of fit
5354
#' statistics for use in the development of logistic regression models.
54-
#' \emph{American Journal of Epidemiology}, 115(1), 92-106.
55+
#' *American Journal of Epidemiology*, 115(1), 92-106.
5556
#'
5657
#' @importFrom vcd rootogram
5758
#' @keywords htest

0 commit comments

Comments
 (0)