You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+51-14Lines changed: 51 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -51,20 +51,27 @@ and the [gnm](https://CRAN.R-project.org/package=gnm) package for *Generalized N
51
51
In particular, `vcdExtra` extends mosaic, assoc and sieve plots from vcd to handle `glm()` and
52
52
`gnm()` models and
53
53
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
55
56
for implementing visualization and other displays for _n_-way frequency tables which have a nested, hierarchical
56
57
structure in [vcd](https://CRAN.R-project.org/package=vcd).
57
58
[This can be compared to the "productplots" framework in [producplots](https://CRAN.R-project.org/package=productplots),
58
59
and the defunct `ggmosaic` package]
59
60
61
+
60
62
`vcdExtra` also adds extensions to modeling functions for models fit using `glm()` and `MASS::loglm()`, using the construct `glmlist()`
61
63
to construct a list of related models which can be summarized (via `LRstats()`) and graphed (via `mosaic.glmlist()`)
62
64
63
65
`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
64
66
[web site for DDAR](http://ddar.datavis.ca) with all figures and code samples from the book.
65
67
It is also used in my graduate course, [Psy 6136: Categorical Data Analysis](https://friendly.github.io/psy6136/).
66
68
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
68
75
69
76
Get the released version (`r cran_version`) from CRAN:
70
77
@@ -102,9 +109,12 @@ or other commonly used packages.
102
109
103
110
* A companion package, [`nestedLogit`](https://friendly.github.io/nestedLogit/), for fitting nested dichotomy logistic regression models for a polytomous response.
104
111
105
-
#### vcdExtra Highlights
112
+
## 💡 vcdExtra Highlights
113
+
114
+
What's in the box?
115
+
116
+
### Mosaic plot extensions
106
117
107
-
##### mosaic plot extensions
108
118
* The method `mosaic.glm()`
109
119
extends the `mosaic.loglm()` method in the vcd
110
120
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 (
117
127
introduces a 3D generalization of mosaic displays using the
* 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
121
136
* A new class, `glmlist`, is introduced for working with
122
137
collections of glm objects, e.g., `Kway()` for fitting
123
138
all K-way models from a basic marginal model, and `LRstats()`
@@ -136,17 +151,19 @@ specification of terms in model formulas using
136
151
`gnm::Diag()`,
137
152
`gnm::Topo(),` etc. in the [gnm](https://CRAN.R-project.org/package=gnm) package.
138
153
139
-
#### Other additions
154
+
###Datasets
140
155
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.
142
157
The vignette, `vignette("datasets", package="vcdExtra")` provides a classification of these
143
158
according to methods of analysis.
144
159
145
160
```{r vcdExtra-datasets}
146
161
vcdExtra::datasets("vcdExtra")[,1]
147
162
```
148
163
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")`;
* 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.
164
184
165
185
* A re-implementation of `vcd::woolf_test()` extends the analysis of homogeneity of odds ratios
166
186
in 2 x 2 x R x C tables to provide tests for differences among the R strata rows and C strata columns.
167
187
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
169
196
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.
171
206
172
207
## Examples
173
208
@@ -319,6 +354,8 @@ anova(indep, linlin, roweff, test = "Chisq")
319
354
320
355
## References
321
356
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
+
322
359
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.
323
360
324
361
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/
0 commit comments