Print method for a
'lav_betaselect' object, which
is the output of
lav_betaselect()
.
Arguments
- x
A
lav_betaselect
-class object, such as the output oflav_betaselect()
.- ...
Optional arguments to be passed to
print()
methods.- nd
The number of digits after the decimal place. Default is 3.
- output
String. How the results are printed. Default is
"lavaan.printer"
, and the results will be printed in a format similar to the printout of the output of thesummary
-method of a 'lavaan'-class object. If set to"table"
, the results are printed in a table format similar to that oflavaan::parameterEstimates()
withoutput
set to"data.frame"
.- standardized_only
Logical. If
TRUE
, the default, only the results for the standardized solution will be printed. IfFALSE
, then the standardized solution is printed alongside the unstandardized solution, as in the printout of the output ofsummary()
of a 'lavaan'-class object.- show_Bs.by
Logical. If
TRUE
andoutput
is"lavaan.printer"
, then the column"Bs.by"
is shown, indicating, for each parameter, the variables standardized. This column is not shown ifoutput
is not"lavaan.printer"
.- by_group
If
TRUE
, the default, and the model has more than one group, sections will be grouped by groups first, as in the print out ofsummary()
inlavaan
. IfFALSE
, then the sections will be grouped by sections first.- na_str
The string to be used for cells with
NA
. Default is" "
, a whitespace.- sig_stars
If
TRUE
, the default, symbols such as asterisks (*
,**
,***
) will be used to denote whether a beta-select is significant.- ci_sig
If
TRUE
, the default, a beta-select will be denoted as significant or not significant based on its confidence interval.
Details
The default format of the printout,
"lavaan.printer"
,
is similar to that of the summary()
of a lavaan
object.
Users can also select whether
only the standardized solution is
printed or whether
the standardized solution is appended
to the right of the printout.
If output
is set to "table"' the format is that of [lavaan::parameterEstimates()] with
output = "data.frame"`,
which is compact but not easy to
read.
See also
lav_betaselect()
. This
function is adapted from
semhelpinghands::print.std_solution_boot()
.
Author
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
Examples
library(lavaan)
mod <-
"
med ~ iv + mod + iv:mod
dv ~ med + iv
"
fit <- sem(mod,
data_test_medmod,
fixed.x = TRUE)
summary(fit)
#> lavaan 0.6-19 ended normally after 3 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 7
#>
#> Number of observations 200
#>
#> Model Test User Model:
#>
#> Test statistic 2.685
#> Degrees of freedom 2
#> P-value (Chi-square) 0.261
#>
#> Parameter Estimates:
#>
#> Standard errors Standard
#> Information Expected
#> Information saturated (h1) model Structured
#>
#> Regressions:
#> Estimate Std.Err z-value P(>|z|)
#> med ~
#> iv -6.339 0.997 -6.357 0.000
#> mod -3.903 0.622 -6.277 0.000
#> iv:mod 0.286 0.039 7.248 0.000
#> dv ~
#> med 0.093 0.011 8.298 0.000
#> iv 0.229 0.039 5.917 0.000
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> .med 61.851 6.185 10.000 0.000
#> .dv 2.104 0.210 10.000 0.000
#>
fit_beta <- lav_betaselect(fit,
to_standardize = c("iv", "dv"))
fit_beta
#>
#> Selected Standardization:
#>
#> Standard Error: Nil
#>
#> Parameter Estimates Settings:
#>
#> Standard errors: Standard
#> Information: Expected
#> Information saturated (h1) model: Structured
#>
#> Regressions:
#> BetaSelect
#> med ~
#> iv -17.697
#> mod -3.903
#> iv:mod 0.797
#> dv ~
#> med 0.049
#> iv 0.333
#>
#> Covariances:
#> BetaSelect
#> iv ~~
#> mod 1.894
#> iv:mod 35.189
#> mod ~~
#> iv:mod 174.847
#>
#> Variances:
#> BetaSelect
#> .med 61.851
#> .dv 0.574
#> iv 1.000
#> mod 23.129
#> iv:mod 1862.983
#>
#> Footnote:
#> - Variable(s) standardized: dv, iv
#> - Call 'print()' and set 'standardized_only' to 'FALSE' to print both
#> original estimates and betas-select.
#> - Product terms (iv:mod) have variables standardized before computing
#> them. The product term(s) is/are not standardized.
print(fit_beta)
#>
#> Selected Standardization:
#>
#> Standard Error: Nil
#>
#> Parameter Estimates Settings:
#>
#> Standard errors: Standard
#> Information: Expected
#> Information saturated (h1) model: Structured
#>
#> Regressions:
#> BetaSelect
#> med ~
#> iv -17.697
#> mod -3.903
#> iv:mod 0.797
#> dv ~
#> med 0.049
#> iv 0.333
#>
#> Covariances:
#> BetaSelect
#> iv ~~
#> mod 1.894
#> iv:mod 35.189
#> mod ~~
#> iv:mod 174.847
#>
#> Variances:
#> BetaSelect
#> .med 61.851
#> .dv 0.574
#> iv 1.000
#> mod 23.129
#> iv:mod 1862.983
#>
#> Footnote:
#> - Variable(s) standardized: dv, iv
#> - Call 'print()' and set 'standardized_only' to 'FALSE' to print both
#> original estimates and betas-select.
#> - Product terms (iv:mod) have variables standardized before computing
#> them. The product term(s) is/are not standardized.
print(fit_beta, show_Bs.by = TRUE)
#>
#> Selected Standardization:
#>
#> Standard Error: Nil
#>
#> Parameter Estimates Settings:
#>
#> Standard errors: Standard
#> Information: Expected
#> Information saturated (h1) model: Structured
#>
#> Regressions:
#> BetaSelect Selected
#> med ~
#> iv -17.697 iv
#> mod -3.903
#> iv:mod 0.797 iv
#> dv ~
#> med 0.049 dv
#> iv 0.333 iv,dv
#>
#> Covariances:
#> BetaSelect Selected
#> iv ~~
#> mod 1.894 iv
#> iv:mod 35.189 iv
#> mod ~~
#> iv:mod 174.847 iv
#>
#> Variances:
#> BetaSelect Selected
#> .med 61.851
#> .dv 0.574 dv
#> iv 1.000 iv
#> mod 23.129
#> iv:mod 1862.983 iv
#>
#> Footnote:
#> - Variable(s) standardized: dv, iv
#> - Call 'print()' and set 'standardized_only' to 'FALSE' to print both
#> original estimates and betas-select.
#> - The column 'Selected' lists variable(s) standardized when computing
#> the standardized coefficient of a parameter. ('NA' for user-defined
#> parameters because they are computed from other standardized
#> parameters.)
#> - Product terms (iv:mod) have variables standardized before computing
#> them. The product term(s) is/are not standardized.
print(fit_beta, output = "table")
#> lhs op rhs est se z pvalue ci.lower ci.upper std.p
#> 1 med ~ iv -6.339 0.997 -6.357 0 -8.293 -4.385 -17.697
#> 2 med ~ mod -3.903 0.622 -6.277 0 -5.122 -2.684 -3.903
#> 3 med ~ iv:mod 0.286 0.039 7.248 0 0.208 0.363 0.797
#> 4 dv ~ med 0.093 0.011 8.298 0 0.071 0.115 0.049
#> 5 dv ~ iv 0.229 0.039 5.917 0 0.153 0.304 0.333
#> 6 med ~~ med 61.851 6.185 10.000 0 49.728 73.974 61.851
#> 7 dv ~~ dv 2.104 0.210 10.000 0 1.692 2.517 0.574
#> 8 iv ~~ iv 7.795 0.000 NA NA 7.795 7.795 1.000
#> 9 iv ~~ mod 5.287 0.000 NA NA 5.287 5.287 1.894
#> 10 iv ~~ iv:mod 274.291 0.000 NA NA 274.291 274.291 35.189
#> 11 mod ~~ mod 23.129 0.000 NA NA 23.129 23.129 23.129
#> 12 mod ~~ iv:mod 488.157 0.000 NA NA 488.157 488.157 174.847
#> 13 iv:mod ~~ iv:mod 14521.504 0.000 NA NA 14521.504 14521.504 1862.983
#> std.p.by
#> 1 iv
#> 2
#> 3 iv
#> 4 dv
#> 5 iv,dv
#> 6
#> 7 dv
#> 8 iv
#> 9 iv
#> 10 iv
#> 11
#> 12 iv
#> 13 iv