View source: R/convert_param.R
convert_betaXA_to_betaXB | R Documentation |
This function allows for the conversion of parameters between design matrices
that are equivalent (same data, same rank) but that have been parameterized
differently. This is usefull to find conversion of parameters for different
contrasts matrices (e.g. contrast treament vs contrast sum), including
conversion between poly(..., raw = FALSE)
and
poly(..., raw = TRUE)
.
convert_betaXA_to_betaXB(XA, XB, betaXA)
XA |
The orignal design matrix |
XB |
A design matrix equivalent to the original design matrix but with different parameterization |
betaXA |
The vector of coefficients for the original design matrix |
The vector of coefficients for the design matrix XB
xa <- model.matrix(object = ~ x, data = data.frame(x = factor(c("A", "B", "C"))),
contrasts.arg = list(x = "contr.treatment"))
xb <- model.matrix(object = ~ x, data = data.frame(x = factor(c("A", "B", "C"))),
contrasts.arg = list(x = "contr.sum"))
beta_xa <- c(0.5, 2, 1)
beta_xb <- convert_betaXA_to_betaXB(XA = xa, XB = xb, betaXA = beta_xa)
## test that we get same predictions as we should:
xa %*% beta_xa
xb %*% beta_xb
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.