🔧 Displaying a model matrix in R
Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to
If you want to see how R will represent a factor in a model, you can use the model.matrix
function.
For example, with unordered factors the model produces dummy variables.
> p = letters[1:4] |> factor()
> model.matrix(~p)
(Intercept) pb pc pd
1 1 0 0 0
2 1 1 0 0
3 1 0 1 0
4 1 0 0 1
For ordered factors, it produces polynomial contrasts.
> p = letters[1:4] |> factor(ordered = TRUE)
> model.matrix(~p)
(Intercept) p.L p.Q p.C
1 1 -0.6708204 0.5 -0.2236068
2 1 -0.2236068 -0.5 0.6708204
3 1 0.2236068 -0.5 -0.6708204
4 1 0.6708204 0.5 0.2236068
🔧 Displaying a model matrix in R
📈 36 Punkte
🔧 Programmierung
🎥 Matrix Live S09E20 — Moodle adopts Matrix
📈 21.94 Punkte
🎥 Videos
📰 Matrix 1.0: Matrix-Projekt beendet Betaphase
📈 21.94 Punkte
📰 IT Nachrichten
🎥 Matrix Live S09E14 — The Matrix Elm SDK
📈 21.94 Punkte
🎥 Video | Youtube
🎥 Matrix Tutorial#14 – Bridging Discourse to Matrix
📈 21.94 Punkte
🎥 Videos
🎥 Matrix Live S01E03 - Matrix Live Demos
📈 21.94 Punkte
🎥 Video | Youtube
🐧 ascii-matrix: render ascii art + matrix effect
📈 21.94 Punkte
🐧 Linux Tipps
🎥 Matrix Live S09E31 — The Matrix Conference
📈 21.94 Punkte
🎥 Videos
🎥 Matrix Live S09E21 — Matrix & Element demos!
📈 21.94 Punkte
🎥 Videos