-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRcode.qmd
More file actions
98 lines (66 loc) · 7.27 KB
/
Rcode.qmd
File metadata and controls
98 lines (66 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
title: "R Code for Figures and Analyses"
---
This online appendix lists the R source files used to produce some of the figures and analyses in each chapter, with links to the source code on GitHub.
This is included here because it may be useful to readers to see the complete context in which many examples were developed, beyond the code displayed in the text. And also because you may want to use or adapt the code for your own work or to develop related examples using the same ideas with different datasets.
It is incomplete because it was consctructed by scanning the chapter source files for special comments,
of the form `<!-- fig.code: R/Davis-reg.R -->` that were manually embedded in the chapter `.qmd` files as I wrote this, but not always.
Making this less incomplete proved to be a challenge because it involved scanning the text to find the corresponding R code files that had been included that had been included in chunks.
Files marked ⚠ do not yet have a descriptive title in their header.
## Chapter 3: Getting Started {.unnumbered}
- [Davis-reg.R](https://github.com/friendly/vis-MLM-book/blob/master/R/Davis-reg.R) — Davis data-- Models and plots
- [draft1970.R](https://github.com/friendly/vis-MLM-book/blob/master/R/draft1970.R) — 1970 Draft Lottery
## Chapter 4: Plots of Multivariate Data {.unnumbered}
- [Salaries-scatterplots.R](https://github.com/friendly/vis-MLM-book/blob/master/R/Salaries-scatterplots.R) — Salaries data: scatterplots
- [ellipses-coverage.R](https://github.com/friendly/vis-MLM-book/blob/master/R/ellipses-coverage.R) — demo ellipses of varying coverage
- [prestige.R](https://github.com/friendly/vis-MLM-book/blob/master/R/prestige/prestige.R) — Prestige data plots
- [peng-ggplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng-ggplot.R) — Penguins data, scatterplot matrix, data ellipses and 2D density plots
- [geom-bagplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/geom-bagplot.R) — geom_bagplot-- penguin data
- [peng-ggally.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng-ggally.R) — Penguin data, GGally ggpairs
- [peng-ggpcp.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng-ggpcp.R) — Penguin data, parallel coordinate plots
## Chapter 5: Dimension Reduction {.unnumbered}
- [workers-pca.R](https://github.com/friendly/vis-MLM-book/blob/master/R/workers-pca.R) — Workers data - pca
- [crime-ggbiplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/crime/crime-ggbiplot.R) — crime data - ggbiplot
- ⚠ `R/crime/factominer.R` — *file not found*
- [diabetes-3d.R](https://github.com/friendly/vis-MLM-book/blob/master/R/diabetes/diabetes-3d.R) — Diabetes data, 3D plots
- ⚠ [diabetes-ggbiplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/diabetes/diabetes-ggbiplot.R) — *no title*
- [diabetes-mds.R](https://github.com/friendly/vis-MLM-book/blob/master/R/diabetes/diabetes-mds.R) — Diabetes data, multidimensional scaling (MDS)
- [diabetes-pca-tsne.R](https://github.com/friendly/vis-MLM-book/blob/master/R/diabetes/diabetes-pca-tsne.R) — Animate transition from PCA <--> tsne
- [mtcars-corrplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/mtcars-corrplot.R) — Variable ordering based on PCA & corrplot
- [outlier-demo.R](https://github.com/friendly/vis-MLM-book/blob/master/R/outlier-demo.R) — Demonstrate correlated data with 2 outliers
## Chapter 6: Overview of Linear models {.unnumbered}
- [workers-reg.R](https://github.com/friendly/vis-MLM-book/blob/master/R/workers-reg.R) — Workers data - regression models
## Chapter 7: Plots for Univariate Response Models {.unnumbered}
- [dunc-conf-ellipse.R](https://github.com/friendly/vis-MLM-book/blob/master/R/Duncan/dunc-conf-ellipse.R) — Duncan data Confidence ellipse
- [levdemo.R](https://github.com/friendly/vis-MLM-book/blob/master/R/levdemo.R) — Leverage and influence demo
- [hatvalues-demo.R](https://github.com/friendly/vis-MLM-book/blob/master/R/hatvalues-demo.R) — leverage and the data ellipse
## Chapter 8: Topics in Linear Models {.unnumbered}
- [dual-points-lines.R](https://github.com/friendly/vis-MLM-book/blob/master/R/dual-points-lines.R) — Illustrate dual points & lines
- [measerr-demo.R](https://github.com/friendly/vis-MLM-book/blob/master/R/measerr-demo.R) — Simulation for measurement error
## Chapter 9: Collinearity & Ridge Regression {.unnumbered}
- [collin-data-beta.R](https://github.com/friendly/vis-MLM-book/blob/master/R/collin-data-beta.R) — collinearity in data and beta space
- [cars-colldiag.R](https://github.com/friendly/vis-MLM-book/blob/master/R/cars-colldiag.R) — cars data - collinearity diagnostics examples
- [collin-centering.R](https://github.com/friendly/vis-MLM-book/blob/master/R/collin-centering.R) — demonstrate effect of centering
- [acetylene-colldiag.R](https://github.com/friendly/vis-MLM-book/blob/master/R/acetylene-colldiag.R) — Acetylene data
- [genridge-longley-figs1.R](https://github.com/friendly/vis-MLM-book/blob/master/R/genridge-longley-figs1.R) — Longley data-- generalized ridge trace plots
- [genridge-longley-figs2.R](https://github.com/friendly/vis-MLM-book/blob/master/R/genridge-longley-figs2.R) — Longley data-- generalized ridge trace plots
## Chapter 10: Hotelling's $T^2$ {.unnumbered}
- [mathscore-figs.R](https://github.com/friendly/vis-MLM-book/blob/master/R/mathscore/mathscore-figs.R) — mathscore data
- [banknote.R](https://github.com/friendly/vis-MLM-book/blob/master/R/banknote.R) — banknote data
## Chapter 12: Visualizing Multivariate Models {.unnumbered}
- [dogfood-quartet.R](https://github.com/friendly/vis-MLM-book/blob/master/R/dogfood/dogfood-quartet.R) — dogfood quartet
## Chapter 14: Multivariate Influence and Robust Estimation {.unnumbered}
- [mvinfluence-Toy.R](https://github.com/friendly/vis-MLM-book/blob/master/R/mvinfluence-Toy.R) — toy example for multivariate influence
- [peng-manova.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng-manova.R) — Penguins MANOVA
## Appendix: Discriminant analysis {.unnumbered}
- [peng-lda-pred-new.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng-lda-pred-new.R) — Penguin prediction plots
- [iris-lda-ggplot.R](https://github.com/friendly/vis-MLM-book/blob/master/R/iris/iris-lda-ggplot.R) — plot LDA boundaries with ggplot
- [peng.lda.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/peng.lda.R) — Penguin data-- lda plots
## Rcode {.unnumbered}
- [Davis-reg.R](https://github.com/friendly/vis-MLM-book/blob/master/R/Davis-reg.R) — Davis data-- Models and plots
## Utilities {.unnumbered}
These R files are `source()`d by one or more of the scripts above.
They define custom functions and helpers used across multiple chapters.
- [penguin-colors.R](https://github.com/friendly/vis-MLM-book/blob/master/R/penguin/penguin-colors.R) — penguin colors
- [ggvectors.R](https://github.com/friendly/vis-MLM-book/blob/master/R/ggvectors.R) — Draw labeled vectors in a ggplot scene
- [text.usr.R](https://github.com/friendly/vis-MLM-book/blob/master/R/util/text.usr.R) — Add text to a plot at normalized device coordinates