dear jamovi makers,
first, we would like to make you a compliment. jamovi is great!
but we may have encountered an error on medmod.
generate a data set wirh the followin r-code
rm(list = ls(all = TRUE)) # clears workspace
require(MASS)
n <- 1000 # set sample size
x <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
z <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
y <- 2*x + 3*z + 4*x*z + 1 + mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
xyz <-data.frame(x, y, z)
lm(y ~ x*z, xyz)
save(xyz, file="d:/xyz.RData")
if you run now the analysis with medmod, you will get different results than the lm comand provided (additionally, no constant is displayed. if you analyse via jamovi with linear regression, resuls are correct.
best, camila and jochen
possible error in medmod
Re: possible error in medmod
hi,
i'll get ravi to comment on this (he usually takes a few days to respond), but the difference here likely reflects the difference between lm() and lavaan (medmod is based on lavaan) which do things a bit differently.
cheers
jonathon
i'll get ravi to comment on this (he usually takes a few days to respond), but the difference here likely reflects the difference between lm() and lavaan (medmod is based on lavaan) which do things a bit differently.
cheers
jonathon
Re: possible error in medmod
thanks jonathon for your fast response. but when i use lavaan, i get results identical to the ones i get from lm. and for such simple data without missings i have expected this. have a look:
rm(list = ls(all = TRUE)) # clears workspace
require(MASS)
require(lavaan)
n <- 1000 # set sample size
x <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
z <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
y <- 2*x + 3*z + 4*x*z + 1 + mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
xyz <-data.frame(x, y, z)
lm(y ~ x*z, xyz)
summary(sem(model="y ~ x+z+x:z", xyz)) # here is the lavaan command
write.csv(xyz, file="d:/xyz.csv") # here i switched to csv-data. works perfectly with jamovi
i am afraid something else is wrong.
best, jochen
rm(list = ls(all = TRUE)) # clears workspace
require(MASS)
require(lavaan)
n <- 1000 # set sample size
x <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
z <- mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
y <- 2*x + 3*z + 4*x*z + 1 + mvrnorm(n = n, 0, 1, tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
xyz <-data.frame(x, y, z)
lm(y ~ x*z, xyz)
summary(sem(model="y ~ x+z+x:z", xyz)) # here is the lavaan command
write.csv(xyz, file="d:/xyz.csv") # here i switched to csv-data. works perfectly with jamovi
i am afraid something else is wrong.
best, jochen
Re: possible error in medmod
sure. i guess we'll wait for ravi then. in the mean time, the code for medmod is here, if you'd like to take a look:
https://github.com/raviselker/medmod/tree/master/R
cheers
jonathon
https://github.com/raviselker/medmod/tree/master/R
cheers
jonathon
Re: possible error in medmod
Could have something to do with medmod centering variables before passing them on to the model: https://github.com/raviselker/medmod/bl ... #L198-L201
Re: possible error in medmod
Hi, @jochen.
Moderation of jamovi's medmod module, as Estimate reports the Average as the effect of the predictor (x) on the dependent variable (y) at the different levels of the moderator (z) and vice versa
Try selecting the "Simple Slope Analysis" Estimates checkbox and swapping x and z as predictor and moderator.
You will have confirmation of what was said above.
Cheers,
Maurizio
For Jonathon
Just to keep third place.
Moderation of jamovi's medmod module, as Estimate reports the Average as the effect of the predictor (x) on the dependent variable (y) at the different levels of the moderator (z) and vice versa
Try selecting the "Simple Slope Analysis" Estimates checkbox and swapping x and z as predictor and moderator.
You will have confirmation of what was said above.
Cheers,
Maurizio
For Jonathon
Just to keep third place.
Re: possible error in medmod
the point goes to ravi: centering is the solution.
many thanks to all of you,
camila and jochen
many thanks to all of you,
camila and jochen