Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more probe crap #103

Closed
TDJorgensen opened this issue Oct 28, 2021 · 3 comments
Closed

more probe crap #103

TDJorgensen opened this issue Oct 28, 2021 · 3 comments
Labels
bug reprex showing an error or incorrect output

Comments

@TDJorgensen
Copy link
Member

Fix this:

dat2wayRC <- orthogonalize(dat2way, 1:3, 4:6)
dat2wayRC$g <- 1:2

model2 <- "
f1  =~ x1 + x2 + x3
f2  =~ x4 + x5 + x6
f12 =~ x1.x4 + x2.x5 + x3.x6
f3  =~ x7 + x8 + x9

f3 ~ f1 + q1*f2 + r1*f12

f12 ~~ 0*f1 + 0*f2

x1 + x4 + x1.x4 + x7 ~ 0*1 # identify latent means
f1 + f2 + f12 ~ NA*1
f3 ~ NA*1 + c(b0.g1, b0.g2)*1
"
fit2 <- sem(model2, data = dat2wayRC, group = "g")

probe2WayRC(fit2, nameX = c("f2", "f1", "f12"), nameY = "f3",
            modVar = "f2", valProbe = c(-1, 0, 1), group = 2)
## error above, not below.  Order should NOT matter
probe2WayRC(fit2, nameX = c("f1", "f2", "f12"), nameY = "f3",
            modVar = "f2", valProbe = c(-1, 0, 1), group = 2)

@schoam4
Copy link
Member

schoam4 commented Nov 2, 2021

Should we rewrite explicitly asking for names of each variable as separate arguments (focal predictor, moderator, interaction and y)?

@TDJorgensen TDJorgensen added the bug reprex showing an error or incorrect output label Jan 24, 2022
@TDJorgensen
Copy link
Member Author

@schoam4 I'd love to, but I'm worried about backwards compatibility, and making our recent tutorial inconsistent within less than a year of publication. Yves reported another related issue (#108). I'm going to try to wrap both of these up next week.

@TDJorgensen
Copy link
Member Author

Oh damn, turns out the problem only exists when labeling one (not both) of the main-effect parameters and the moderator is listed first in nameX=. The problem occurs (also in *MC) when creating labels for parameters that the user didn't label. What happens in the example above is that the first relevant row (regression slopes) of parTable() belongs to f1, which is nameX[2]. Because someone (ahem) designed the loop over integer indices, it made the label using nameX[1] (which is f2, which had its own label from the syntax).

Fixed by replacing nameX[i] with PT$rhs[ newRows[i] ] in all 4 probing functions: 5205cc1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reprex showing an error or incorrect output
Projects
None yet
Development

No branches or pull requests

2 participants