Skip to content

Commit 58340fe

Browse files
committed
edit README
1 parent 63882bd commit 58340fe

2 files changed

Lines changed: 130 additions & 44 deletions

File tree

README.Rmd

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,27 @@ and the [gnm](https://CRAN.R-project.org/package=gnm) package for *Generalized N
5151
In particular, `vcdExtra` extends mosaic, assoc and sieve plots from vcd to handle `glm()` and
5252
`gnm()` models and
5353
adds a 3D version in `mosaic3d()`.
54-
The functions here use the "strucplot" framework (Meyer et-al., 2006), which is a natural conceptual system
54+
55+
The functions here use the "strucplot" framework (Meyer et-al., 2006), which is a lovely, natural conceptual system
5556
for implementing visualization and other displays for _n_-way frequency tables which have a nested, hierarchical
5657
structure in [vcd](https://CRAN.R-project.org/package=vcd).
5758
[This can be compared to the "productplots" framework in [producplots](https://CRAN.R-project.org/package=productplots),
5859
and the defunct `ggmosaic` package]
5960

61+
6062
`vcdExtra` also adds extensions to modeling functions for models fit using `glm()` and `MASS::loglm()`, using the construct `glmlist()`
6163
to construct a list of related models which can be summarized (via `LRstats()`) and graphed (via `mosaic.glmlist()`)
6264

6365
`vcdExtra` is a support package for the book [*Discrete Data Analysis with R*](https://www.routledge.com/Discrete-Data-Analysis-with-R-Visualization-and-Modeling-Techniques-for/Friendly-Meyer/p/book/9781498725835) (DDAR) by Michael Friendly and David Meyer. There is also a
6466
[web site for DDAR](http://ddar.datavis.ca) with all figures and code samples from the book.
6567
It is also used in my graduate course, [Psy 6136: Categorical Data Analysis](https://friendly.github.io/psy6136/).
6668

67-
## Installation
69+
A more general goal of `vcdExtra` is to contribute to the wider topics of _thinking about, analyzing
70+
and visualizing categorical data_, extending this beyond the scope of our book. In this sense,
71+
it continues to be a love letter 💌 to CDA.
72+
73+
74+
## 📂 Installation
6875

6976
Get the released version (`r cran_version`) from CRAN:
7077

@@ -102,9 +109,12 @@ or other commonly used packages.
102109

103110
* A companion package, [`nestedLogit`](https://friendly.github.io/nestedLogit/), for fitting nested dichotomy logistic regression models for a polytomous response.
104111

105-
#### vcdExtra Highlights
112+
## 💡 vcdExtra Highlights
113+
114+
What's in the box?
115+
116+
### Mosaic plot extensions
106117

107-
##### mosaic plot extensions
108118
* The method `mosaic.glm()`
109119
extends the `mosaic.loglm()` method in the vcd
110120
package to this wider class of models, e.g., models for ordinal factors, which can't
@@ -117,7 +127,12 @@ including models for square tables and models with multiplicative associations (
117127
introduces a 3D generalization of mosaic displays using the
118128
[rgl](https://CRAN.R-project.org/package=rgl) package.
119129

120-
##### model extensions
130+
* A new "labeling" method, `labeling_points()` for mosaic plots allows you to show the observed or
131+
expected frequencies in cells as point symbols, thereby showing the data or model in a dot-density
132+
representation. This goes back to an old paper, Friendly(1995), where I describe visual and
133+
conceptual models for categorical data with a physical analog of gas molecules in chambers.
134+
135+
### Model extensions
121136
* A new class, `glmlist`, is introduced for working with
122137
collections of glm objects, e.g., `Kway()` for fitting
123138
all K-way models from a basic marginal model, and `LRstats()`
@@ -136,17 +151,19 @@ specification of terms in model formulas using
136151
`gnm::Diag()`,
137152
`gnm::Topo(),` etc. in the [gnm](https://CRAN.R-project.org/package=gnm) package.
138153

139-
#### Other additions
154+
### Datasets
140155

141-
* many new data sets; use `datasets("vcdExtra")` to see a list with titles and descriptions.
156+
Beyond the wide range of **datasets* in the `vcd` package, this `vcdExtra` package includes many new data sets, that I've found useful for illustrating various ideas, models, methods and visualization. Use `datasets("vcdExtra")` to see a list with titles and descriptions.
142157
The vignette, `vignette("datasets", package="vcdExtra")` provides a classification of these
143158
according to methods of analysis.
144159

145160
```{r vcdExtra-datasets}
146161
vcdExtra::datasets("vcdExtra")[,1]
147162
```
148163

149-
* a [collection of tutorial vignettes](https://cran.r-project.org/web/packages/vcdExtra/vignettes/). In the installed package, they can be viewed using `browseVignettes(package = "vcdExtra")`;
164+
### Vignettes
165+
166+
A [collection of **tutorial vignettes**](https://cran.r-project.org/web/packages/vcdExtra/vignettes/). In the installed package, they can be viewed using `browseVignettes(package = "vcdExtra")`;
150167

151168
```{r vignettes}
152169
vigns <- as.data.frame(tools::getVignetteInfo("vcdExtra")[,c("File", "Title")])
@@ -155,19 +172,37 @@ vigns$Title <- paste0("[", vigns$Title, "](https://friendly.github.io/vcdExtra/a
155172
vigns |> knitr::kable()
156173
```
157174

158-
* there is also a set of simple demonstration files illustrating analysis of datasets with
175+
* there is also a set of simple **demonstration files** illustrating analysis of datasets with
159176
more detail than provided in their individual help files. Use `demo(package = "vcdExtra")`
160-
to see the list and `demo("occStatus") to run the analysis for this example.
177+
to see the list and run `demo("occStatus") to run the analysis for this example, or
178+
`demo("mental-glm")` for another one.
161179

162-
* a few useful utility functions for manipulating categorical data sets and working with models for
163-
categorical data: `joint()`, `conditional()`, `mutual()`, `saturated()`.
180+
* a few useful **utility functions** for manipulating categorical data sets and working with models for
181+
categorical data: `joint()`, `conditional()`, `mutual()`, `saturated()`. These make it easier to specify
182+
`loglm()` and `glm()` models representing a statistical concept, like conditional association, rather than
183+
figuring out a formula like `[AC] [BC]` for a 3-way table or `[AD] [BD] [CD]` for a 4-way table.
164184

165185
* A re-implementation of `vcd::woolf_test()` extends the analysis of homogeneity of odds ratios
166186
in 2 x 2 x R x C tables to provide tests for differences among the R strata rows and C strata columns.
167187

168-
* A collection of demo files illustrating analysis of other datasets and models. Run `demo(package = "vcdExtra")` to see them, and, for example, `demo("mental-glm", package = "vcdExtra")` to run `demo("demo/mental-glm.R")` in your R console.
188+
### Recent work
189+
190+
#### Visual tables
191+
192+
A new function, `color_table()` provides semi-graphic tables of frequency tables or residuals from a loglinear model. The essential idea is to use background shading of cells in the table to show patterns
193+
not discernible in purely numeric tables.
194+
195+
#### Association graphs
169196

170-
* A new function, `color_table()` provides semi-graphic tables of frequency tables or residuals from a loglinear model.
197+
I'm now experimenting with using graphical association representations of models in conjunction with
198+
the other methods, and ways of specifying models here. `assoc_graph()`
199+
Association graphs represent variables as nodes and their partial associations between pairs of variables as edges. They are useful for understanding
200+
If two variables are not connected by an edge, they are conditionally independent given the other variables in the model.
201+
202+
How can we use this in practice, to understand a model, or how well it fits a given dataset?
203+
204+
There is now (rudimentary) a `plot()` method for association graphs which allows edges to be weighted by a measure
205+
of the strength of association between variables: partial $G^2$ or Cramer's V. Still very much a WIP.
171206

172207
## Examples
173208

@@ -319,6 +354,8 @@ anova(indep, linlin, roweff, test = "Chisq")
319354

320355
## References
321356

357+
Friendly, M. (1995). Conceptual and Visual Models for Categorical Data. _The American Statistician_, **49**, 153–160. http://www.datavis.ca/papers/amstat95.pdf
358+
322359
Friendly, M. & Meyer, D. (2016). _Discrete Data Analysis with R: Visualization and Modeling Techniques for Categorical and Count Data_. Boca Raton, FL: Chapman & Hall/CRC.
323360

324361
Meyer, D., Zeileis, A., & Hornik, K. (2006). The Strucplot Framework: Visualizing Multi-way Contingency Tables with vcd. _Journal of Statistical Software_, **17**(3), 1–48. http://www.jstatsoft.org/v17/i03/

README.md

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ Bluesky](https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=0285
2626

2727
<!-- Version 0.8-6 -->
2828

29-
Version 0.9.2; documentation built for `pkgdown` 2026-02-09
29+
Version 0.9.2; documentation built for `pkgdown` 2026-02-13
3030

3131
This package provides additional data sets, documentation, and many
3232
functions designed to extend the
3333
[vcd](https://CRAN.R-project.org/package=vcd) package for *Visualizing
3434
Categorical Data* and the [gnm](https://CRAN.R-project.org/package=gnm)
3535
package for *Generalized Nonlinear Models*. In particular, `vcdExtra`
3636
extends mosaic, assoc and sieve plots from vcd to handle `glm()` and
37-
`gnm()` models and adds a 3D version in `mosaic3d()`. The functions here
38-
use the “strucplot” framework (Meyer et-al., 2006), which is a natural
39-
conceptual system for implementing visualization and other displays for
40-
*n*-way frequency tables which have a nested, hierarchical structure in
37+
`gnm()` models and adds a 3D version in `mosaic3d()`.
38+
39+
The functions here use the “strucplot” framework (Meyer et-al., 2006),
40+
which is a lovely, natural conceptual system for implementing
41+
visualization and other displays for *n*-way frequency tables which have
42+
a nested, hierarchical structure in
4143
[vcd](https://CRAN.R-project.org/package=vcd). \[This can be compared to
4244
the “productplots” framework in
4345
[producplots](https://CRAN.R-project.org/package=productplots), and the
@@ -56,7 +58,12 @@ for DDAR](http://ddar.datavis.ca) with all figures and code samples from
5658
the book. It is also used in my graduate course, [Psy 6136: Categorical
5759
Data Analysis](https://friendly.github.io/psy6136/).
5860

59-
## Installation
61+
A more general goal of `vcdExtra` is to contribute to the wider topics
62+
of *thinking about, analyzing and visualizing categorical data*,
63+
extending this beyond the scope of our book. In this sense, it continues
64+
to be a love letter 💌 to CDA.
65+
66+
## 📂 Installation
6067

6168
Get the released version (0.9.1) from CRAN:
6269

@@ -104,9 +111,11 @@ packages.
104111
[`nestedLogit`](https://friendly.github.io/nestedLogit/), for fitting
105112
nested dichotomy logistic regression models for a polytomous response.
106113

107-
#### vcdExtra Highlights
114+
## 💡 vcdExtra Highlights
115+
116+
What’s in the box?
108117

109-
##### mosaic plot extensions
118+
### Mosaic plot extensions
110119

111120
- The method `mosaic.glm()` extends the `mosaic.loglm()` method in the
112121
vcd package to this wider class of models, e.g., models for ordinal
@@ -119,7 +128,14 @@ packages.
119128
- `mosaic3d()` introduces a 3D generalization of mosaic displays using
120129
the [rgl](https://CRAN.R-project.org/package=rgl) package.
121130

122-
##### model extensions
131+
- A new “labeling” method, `labeling_points()` for mosaic plots allows
132+
you to show the observed or expected frequencies in cells as point
133+
symbols, thereby showing the data or model in a dot-density
134+
representation. This goes back to an old paper, Friendly(1995), where
135+
I describe visual and conceptual models for categorical data with a
136+
physical analog of gas molecules in chambers.
137+
138+
### Model extensions
123139

124140
- A new class, `glmlist`, is introduced for working with collections of
125141
glm objects, e.g., `Kway()` for fitting all K-way models from a basic
@@ -139,12 +155,14 @@ packages.
139155
`gnm::Diag()`, `gnm::Topo(),` etc. in the
140156
[gnm](https://CRAN.R-project.org/package=gnm) package.
141157

142-
#### Other additions
158+
### Datasets
143159

144-
- many new data sets; use `datasets("vcdExtra")` to see a list with
145-
titles and descriptions. The vignette,
146-
`vignette("datasets", package="vcdExtra")` provides a classification
147-
of these according to methods of analysis.
160+
Beyond the wide range of \*\*datasets\* in the `vcd` package, this
161+
`vcdExtra` package includes many new data sets, that I’ve found useful
162+
for illustrating various ideas, models, methods and visualization. Use
163+
`datasets("vcdExtra")` to see a list with titles and descriptions. The
164+
vignette, `vignette("datasets", package="vcdExtra")` provides a
165+
classification of these according to methods of analysis.
148166

149167
``` r
150168
vcdExtra::datasets("vcdExtra")[,1]
@@ -162,10 +180,12 @@ vcdExtra::datasets("vcdExtra")[,1]
162180
## [45] "Vote1980" "WorkerSat" "Yamaguchi87"
163181
```
164182

165-
- a [collection of tutorial
166-
vignettes](https://cran.r-project.org/web/packages/vcdExtra/vignettes/).
167-
In the installed package, they can be viewed using
168-
`browseVignettes(package = "vcdExtra")`;
183+
### Vignettes
184+
185+
A [collection of **tutorial
186+
vignettes**](https://cran.r-project.org/web/packages/vcdExtra/vignettes/).
187+
In the installed package, they can be viewed using
188+
`browseVignettes(package = "vcdExtra")`;
169189

170190
``` r
171191
vigns <- as.data.frame(tools::getVignetteInfo("vcdExtra")[,c("File", "Title")])
@@ -186,26 +206,51 @@ vigns |> knitr::kable()
186206
| datasets.Rmd | [Datasets for categorical data analysis](https://friendly.github.io/vcdExtra/articles/datasets.html) |
187207
| tidyCats.Rmd | [tidyCat: Tidy Methods For Categorical Data Analysis](https://friendly.github.io/vcdExtra/articles/tidyCats.html) |
188208

189-
- there is also a set of simple demonstration files illustrating
209+
- there is also a set of simple **demonstration files** illustrating
190210
analysis of datasets with more detail than provided in their
191211
individual help files. Use `demo(package = "vcdExtra")` to see the
192-
list and \`demo(“occStatus”) to run the analysis for this example.
193-
194-
- a few useful utility functions for manipulating categorical data sets
195-
and working with models for categorical data: `joint()`,
196-
`conditional()`, `mutual()`, `saturated()`.
212+
list and run
213+
`demo("occStatus") to run the analysis for this example, or`demo(“mental-glm”)\`
214+
for another one.
215+
216+
- a few useful **utility functions** for manipulating categorical data
217+
sets and working with models for categorical data: `joint()`,
218+
`conditional()`, `mutual()`, `saturated()`. These make it easier to
219+
specify `loglm()` and `glm()` models representing a statistical
220+
concept, like conditional association, rather than figuring out a
221+
formula like `[AC] [BC]` for a 3-way table or `[AD] [BD] [CD]` for a
222+
4-way table.
197223

198224
- A re-implementation of `vcd::woolf_test()` extends the analysis of
199225
homogeneity of odds ratios in 2 x 2 x R x C tables to provide tests
200226
for differences among the R strata rows and C strata columns.
201227

202-
- A collection of demo files illustrating analysis of other datasets and
203-
models. Run `demo(package = "vcdExtra")` to see them, and, for
204-
example, `demo("mental-glm", package = "vcdExtra")` to run
205-
`demo("demo/mental-glm.R")` in your R console.
228+
### Recent work
206229

207-
- A new function, `color_table()` provides semi-graphic tables of
208-
frequency tables or residuals from a loglinear model.
230+
#### Visual tables
231+
232+
A new function, `color_table()` provides semi-graphic tables of
233+
frequency tables or residuals from a loglinear model. The essential idea
234+
is to use background shading of cells in the table to show patterns not
235+
discernible in purely numeric tables.
236+
237+
#### Association graphs
238+
239+
I’m now experimenting with using graphical association representations
240+
of models in conjunction with the other methods, and ways of specifying
241+
models here. `assoc_graph()` Association graphs represent variables as
242+
nodes and their partial associations between pairs of variables as
243+
edges. They are useful for understanding If two variables are not
244+
connected by an edge, they are conditionally independent given the other
245+
variables in the model.
246+
247+
How can we use this in practice, to understand a model, or how well it
248+
fits a given dataset?
249+
250+
There is now (rudimentary) a `plot()` method for association graphs
251+
which allows edges to be weighted by a measure of the strength of
252+
association between variables: partial $G^2$ or Cramer’s V. Still very
253+
much a WIP.
209254

210255
## Examples
211256

@@ -439,6 +484,10 @@ anova(indep, linlin, roweff, test = "Chisq")
439484

440485
## References
441486

487+
Friendly, M. (1995). Conceptual and Visual Models for Categorical Data.
488+
*The American Statistician*, **49**, 153–160.
489+
<http://www.datavis.ca/papers/amstat95.pdf>
490+
442491
Friendly, M. & Meyer, D. (2016). *Discrete Data Analysis with R:
443492
Visualization and Modeling Techniques for Categorical and Count Data*.
444493
Boca Raton, FL: Chapman & Hall/CRC.

0 commit comments

Comments
 (0)