Dear Jessica,
As you can see, it's a little hard to look at your commands because of the
lack of newlines, and you also don't give data, so one can't tell which
variables are latent and which observed, but I'm going to guess that this is
a latent-variable model with factors belonging, autonomy, optimism, and
wellbeing, and that the other variables are directly observed. If so, the
model is underidentified because there are no reference indicators (paths
set to 1 from each latent variable to one of its indicators).
As well, even after you fix this problem, the covariances among the
measurement errors of the indicators of optimism and wellbeing underidentify
the model.
Finally, there's nothing wrong with the NAs -- these just show that you
didn't specify any startvalues for the parameters; simply print
wellbeing.model (rather than examining its structure) to see the
specification.
I hope this helps,
John
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of jahughes81
> Sent: March-11-12 10:21 PM
> To: r-help at r-project.org
> Subject: [R] SEM eigen value error 0 X 0 matrix
>
> Using R-studio, I am trying to run a structural equation model and I am
> running into problems with testing my primary model. Once I specify
> everything and try to run it I get this error:
>
> Error in eigen(S, symmetric = TRUE, only.values = TRUE) : 0 x 0 matrix
>
> And when I look at the object for my primary model in my workspace,
> which is created after I specify it, it lists all my model components,
> but has a whole bunch of 'NA' values listed after my components. I
have
> no idea why they are listed there because I omitted all of the 'NA'
> values from my data and can verify this by a visual inspection.
>
> Here is my specified model:
>
> # Primary model
>
> wellbeing.model <- specifyModel()
> belonging -> optimism, path1
> autonomy -> optimism, path2
> optimism -> wellbeing, path3
> belonging -> belonging_hapmar, patha
> belonging -> belonging_attend, pathb
> belonging -> belonging_cowrkint, pathc
> autonomy -> autonomy_overwork, pathd
> autonomy -> autonomy_famwkoff, pathe
> autonomy -> autonomy_hrsrelax, pathf
> optimism -> optimism_confinan, pathg
> optimism -> optimism_goodlife, pathh
> optimism -> optimis_conlegis, pathi
> wellbeing -> wellbeing_happy, pathj
> wellbeing -> wellbeing_health, pathk
> wellbeing -> wellbeing_life, pathl
> belonging <-> autonomy, covariance1
> autonomy_overwork <-> autonomy_famwkoff, covariance2
autonomy_overwork
> <-> autonomy_hrsrelax, covariance3 autonomy_hrsrelax <->
> autonomy_famwkoff, covariance4 belonging <-> belonging, variance1
> autonomy <-> autonomy, variance2 optimism <-> optimism,
disturbance1
> optimism_confinan <-> optimism_goodlife, disturbance2
optimism_goodlife
> <-> optimism_conlegis, disturbance3 optimism_confinan <->
> optimism_conlegis, disturbance4 wellbeing <-> wellbeing, disturbance5
> wellbeing_happy <-> wellbeing_health, disturbance6 wellbeing_happy
<->
> wellbeing_life, disturbance7 wellbeing_health <-> wellbeing_life,
> disturbance8 wellbeing.analysis <- sem( wellbeing.model, gss.data.cov,
> nrow(gss.data_C) ) summary( wellbeing.analysis ) stdCoef(
> wellbeing.analysis ) effects( wellbeing.analysis ) pathDiagram(
> wellbeing.analysis, "WellbeingPathModel", standardize=TRUE,
> edge.labels="values" )
>
> And here are my model components once specified:
>
> structure(c("belonging -> optimism", "autonomy ->
optimism", "optimism
> -> wellbeing", "belonging -> belonging_hapmar",
"belonging ->
> belonging_attend", "belonging -> belonging_cowrkint",
"autonomy ->
> autonomy_overwork", "autonomy -> autonomy_famwkoff",
"autonomy ->
> autonomy_hrsrelax", "optimism -> optimism_confinan",
"optimism ->
> optimism_goodlife", "optimism -> optimis_conlegis",
"wellbeing ->
> wellbeing_happy", "wellbeing -> wellbeing_health",
"wellbeing ->
> wellbeing_life", "belonging <-> autonomy",
"autonomy_overwork <->
> autonomy_famwkoff", "autonomy_overwork <->
autonomy_hrsrelax",
> "autonomy_hrsrelax <-> autonomy_famwkoff", "belonging
<-> belonging",
> "autonomy <-> autonomy", "optimism <->
optimism", "optimism_confinan <-
> > optimism_goodlife", "optimism_goodlife <->
optimism_conlegis",
> "optimism_confinan <-> optimism_conlegis", "wellbeing
<-> wellbeing",
> "wellbeing_happy <-> wellbeing_health",
"wellbeing_happy <->
> wellbeing_life", "wellbeing_health <->
wellbeing_life",
> "belonging_hapmar <-> belonging_hapmar",
"belonging_attend <->
> belonging_attend", "belonging_cowrkint <->
belonging_cowrkint",
> "autonomy_overwork <-> autonomy_overwork",
"autonomy_famwkoff <->
> autonomy_famwkoff", "autonomy_hrsrelax <->
autonomy_hrsrelax",
> "optimism_confinan <-> optimism_confinan",
"optimism_goodlife <->
> optimism_goodlife", "optimis_conlegis <->
optimis_conlegis",
> "wellbeing_happy <-> wellbeing_happy",
"wellbeing_health <->
> wellbeing_health", "wellbeing_life <->
wellbeing_life", "path1",
> "path2", "path3", "patha", "pathb",
"pathc", "pathd", "pathe", "pathf",
> "pathg", "pathh", "pathi", "pathj",
"pathk", "pathl", "covariance1",
> "covariance2", "covariance3", "covariance4",
"variance1", "variance2",
> "disturbance1", "disturbance2",
"disturbance3", "disturbance4",
> "disturbance5", "disturbance6",
"disturbance7", "disturbance8",
> "V[belonging_hapmar]", "V[belonging_attend]",
"V[belonging_cowrkint]",
> "V[autonomy_overwork]", "V[autonomy_famwkoff]",
"V[autonomy_hrsrelax]",
> "V[optimism_confinan]", "V[optimism_goodlife]",
"V[optimis_conlegis]",
> "V[wellbeing_happy]", "V[wellbeing_health]",
"V[wellbeing_life]", NA,
> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> NA, NA, NA, NA), .Dim = c(41L, 3L), class = "semmod")
>
> I have no idea where the 'NA' values are coming from.
>
> Any help would be most appreciated!
>
> -
> Jessica
>
> --
> View this message in context: http://r.789695.n4.nabble.com/SEM-eigen-
> value-error-0-X-0-matrix-tp4465139p4465139.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.