standard error of estimate for absolute value

47 views
Skip to first unread message

Rakoon P

unread,
Jul 29, 2020, 6:46:11 PM7/29/20
to lavaan
Dear lavaan users,

In my path analysis, I'm estimating a parameter "Abs.PM" which takes the ratio of the absolute values of other path coefficients. After fitting the model, I find that the standard error of this Abs.PM parameter is 0, so the Z score and p-value are listed as "NA".
However, if I chose standardized estimates, then the standard error appears just fine. 
My questions are: (1) do you know why the raw output is not returning a standard error value for Abs.PM? and (2) Is it possible for me to obtain the SE of the raw output for Abs.PM?

Thank you for your time,
Rak

Code
library(lavaan) #v0.6-5
###:::::: Population Model ::::::###
set.seed(777)
X <- rnorm(200)
M <- 0.357*X + rnorm(200)
Y <- 0.357*M + (-.023)*X + rnorm(200)
data <- data.frame(X = X, Y = Y, M = M)

###:::::: Estimation Model ::::::###
model <- ' Y ~ direct*X
            M ~ a*X
            Y ~ b*M
            ab := a*b
            PM := ab/(ab + direct)  
            Abs.PM := abs(ab)/(abs(ab)+abs(direct)) '
# ML
fit <- sem(model, data = data)
parameterEstimates(fit)
standardizedSolution(fit)

Raw Output
     lhs op                           rhs  label    est     se      z pvalue ci.lower ci.upper
1      Y  ~                             X direct -0.105  0.071 -1.484  0.138   -0.243    0.034
2      M  ~                             X      a  0.300  0.076  3.942  0.000    0.151    0.450
3      Y  ~                             M      b  0.311  0.063  4.916  0.000    0.187    0.434
4      Y ~~                             Y         0.922  0.092 10.000  0.000    0.741    1.102
5      M ~~                             M         1.154  0.115 10.000  0.000    0.928    1.381
6      X ~~                             X         0.994  0.000     NA     NA    0.994    0.994
7     ab :=                           a*b     ab  0.093  0.030  3.075  0.002    0.034    0.153
8     PM :=                ab/(ab+direct)     PM -8.040 50.667 -0.159  0.874 -107.345   91.266
9 Abs.PM := abs(ab)/(abs(ab)+abs(direct)) Abs.PM  0.471  0.000     NA     NA    0.471    0.471

Standardized output
     lhs op                           rhs est.std     se      z pvalue ci.lower ci.upper
1      Y  ~                             X  -0.103  0.069 -1.495  0.135   -0.238    0.032
2      M  ~                             X   0.269  0.064  4.168  0.000    0.142    0.395
3      Y  ~                             M   0.341  0.066  5.202  0.000    0.212    0.469
4      Y ~~                             Y   0.892  0.041 21.524  0.000    0.811    0.973
5      M ~~                             M   0.928  0.035 26.822  0.000    0.860    0.996
6      X ~~                             X   1.000  0.000     NA     NA    1.000    1.000
7     ab :=                           a*b   0.092  0.029  3.171  0.002    0.035    0.148
8     PM :=                ab/(ab+direct)  -8.040 50.667 -0.159  0.874 -107.345   91.266
9 Abs.PM := abs(ab)/(abs(ab)+abs(direct))   0.471  0.174  2.710  0.007    0.130    0.811

Terrence Jorgensen

unread,
Jul 30, 2020, 9:39:50 AM7/30/20
to lavaan
(1) do you know why the raw output is not returning a standard error value for Abs.PM?

No, but I don't think percentage-mediated is a meaningful metric when the direct and indirect effects are opposite-signed.  If you do want PM anyway, then at least you need to calculated it as Abs.PM := abs(ab)/abs(ab + direct), because the total effect is the sum of direct and indirect effects, not their absolute values.
 
(2) Is it possible for me to obtain the SE of the raw output for Abs.PM?

You could ask for more precision with summary(fit, nd = 6), and you can also find it in the parameterEstimates() output, which is a data.frame, so you could request 

PE <- parameterEstimates(fit)
PE$se
[PE$lhs == "Abs.PM"]

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Rakoon P

unread,
Jul 30, 2020, 10:51:36 AM7/30/20
to lavaan
Thank you again for your feedback Terrence!
Reply all
Reply to author
Forward
0 new messages