
Estimate Regression Coefficients from a Correlation Matrix
find_B.RdEstimate Regression Coefficients from a Correlation Matrix
Arguments
- model_input
Model input as a character string. Multiple models need to be on their own line. Regression syntax uses a lavaan-like
outcome ~ predictor1 + predictor2form.- R
A named correlation matrix, typically the pooled correlation matrix extracted from a fitted
marsobject.
Value
A list of named vectors of standardized regression coefficients, one
element per regression equation in model_input.
Details
Each regression line is parsed independently. For a statement such as
y ~ x1 + x2, find_B() reorders R into predictor and
outcome blocks and computes the standardized least-squares coefficients as
\(R_{xx}^{-1} R_{xy}\). Blank lines and comment lines are ignored by the
lower-level model parser.
Examples
Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775,
-0.09773331, 1.00000000, 0.5271873, -0.4175596,
-0.17550292, 0.5271872, 1.0000000, -0.4006848,
0.31867753, -0.41755963, -0.4006848, 1.0000000),
nrow = 4, byrow = TRUE)
colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" )
rownames(Br) <- colnames(Br)
## Proposed path model
model <- "## Regression paths
Performance ~ Self_confidence + Cognitive + Somatic
Self_confidence ~ Cognitive + Somatic "
find_B(model, Br)
#> [[1]]
#> Self_confidence -> Performance Cognitive -> Performance
#> 0.08316153 -0.09261001
#> Somatic -> Performance
#> 0.31629500
#>
#> [[2]]
#> Cognitive -> Self_confidence Somatic -> Self_confidence
#> 0.4287053 -0.2457839
#>