alexanderrobitzsch / srm

Structural Equation Modeling for the Social Relations Model
https://alexanderrobitzsch.github.io/srm/
5 stars 1 forks source link

exogenous covariates #2

Open TDJorgensen opened 3 years ago

TDJorgensen commented 3 years ago

Hi Alexander,

I have installed the CRAN and development versions of srm to try adding exogenous person-level covariates of actor/partner effects. I have tried this with a couple of the example data sets in the package, and always end up with both point and SE estimates == 0 and NaN Wald tests for the regression coefficients. Here is one example:

library(srm)
data(Kenzer)

mod.Kenzer <- '
%Person
Y@A =~ 1*sociable@A
Y@P =~ 1*sociable@P
sociable@A ~~ 0*sociable@A + 0*sociable@P
sociable@P ~~ 0*sociable@P
Y@A ~ bA*actor.sociable@E
Y@P ~ bA*actor.sociable@E

%Dyad
Y@AP =~ 1*sociable@AP
Y@PA =~ 1*sociable@PA
sociable@AP ~~ 0*sociable@AP + 0*sociable@PA
sociable@PA ~~ 0*sociable@PA
'
fit.Kenzer <- srm(mod.Kenzer, data = Kenzer, rrgroup_name="rrgroup.id",
                  person_names = c("actor.id", "partner.id"),
                  conv_par=1e-4, maxiter=20)
summary(fit.Kenzer)

The output additionally indicates Number of round-robin groups: 0, although there are 7 groups.

table(Kenzer$rrgroup.id)

And the problem with point and SE estimates occurs also for the Back et al. data that have only 1 RR group:

mod.back <- '
%Person
Y@A =~ 1*y@A
Y@P =~ 1*y@P
y@A ~~ 0*y@A + 0*y@P
y@P ~~ 0*y@P
Y@A ~ bA*sex
Y@P ~ bP*sex

%Dyad
Y@AP =~ 1*y@AP
Y@PA =~ 1*y@PA
y@AP ~~ 0*y@AP + 0*y@PA
y@PA ~~ 0*y@PA
'
fit.back <- srm::srm(mod.back, data = data.back,  #rrgroup_name="Group",
                     conv_par=1e-4, maxiter=20)
summary(fit.back)

Perhaps I am not approaching the syntax correctly? I have tried with and without labels, also different and same labels to (not) impose equality constraints, and with(out) the @E suffix for the exogenous predictors.

Thanks for any insight.

alexanderrobitzsch commented 3 years ago

Thanks Terrence for reporting. I am afraid that I can't work on it for about a month. But, then I the issue will certainly be resolved. Very likely, the model has not yet been fully implemented (i.e., translation of model syntax into design matrices).

Thank you in advance for waiting and kind regards, Alexander

TDJorgensen commented 3 years ago

No rush, thanks!