[R] Fit sem: problem of 'Error in solve.default(C[ind, ind]) : Lapack routine dgesv: system is exactly singular.'
John Fox
jfox at mcmaster.ca
Sun Apr 15 20:45:15 CEST 2007
Dear adschai,
This model is almost surely underidentified, but it's hard to figure that
out for sure because of its very odd structure: you have the three latent
variables all influencing each other mutually and all with exactly the same
observed indicators, but the structural disturbances are all specified to be
uncorrelated. Additionally, there are observed exogenous variables that
affect the latent endogenous variables, but these exogenous variables are
also specified to be uncorrelated. It's hard for me to imagine that you
really intended this, and even if the model is identified, I seriously doubt
that you can fit it to the data. Finally, you should verify that the input
covariance matrix is positive-definite.
I think that the issues of model specification go well beyond how to use the
software, and I strongly suggest that you try to find someone local to talk
to about your research.
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
--------------------------------
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> adschai at optonline.net
> Sent: Sunday, April 15, 2007 2:16 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Fit sem: problem of 'Error in
> solve.default(C[ind, ind]) : Lapack routine dgesv: system is
> exactly singular.'
>
> Hi - I would need help another time. I would the model and
> wire the correlation matrix into the sem() method. I got the
> system is exactly singular? Is my model underidentified? Here
> I have my model below along with the result from traceback()
> funciton. Any help would be really appreciated. Thank you again!
>
> Average_Daily_Traffic -> Lat_Env,
> gam1_1, NA
> Average_Daily_Truck_Traffic -> Lat_Env,
> gam1_2, NA
> BridgeAges -> Lat_Env,
> gam1_3, NA
>
> Design_Load -> Lat_Specs,
> gam2_1, NA
> Type_of_Service_On_Bridge -> Lat_Specs,
> gam2_2, NA
> Railroad_Beneath -> Lat_Specs,
> gam2_3, NA
> BridgeAges -> Lat_Specs,
> gam2_4, NA
> Highway_Beneath -> Lat_Specs,
> gam2_5, NA
>
> Main_Structure_Material -> Lat_Design,
> gam3_1, NA
> Main_Structure_Design -> Lat_Design,
> gam3_2, NA
> Length_of_Maximum_Span -> Lat_Design,
> gam3_4, NA
> Number_of_Spans_In_Main_Unit -> Lat_Design,
> gam3_5, NA
> BridgeAges -> Lat_Design,
> gam3_6, NA
>
> Lat_Env -> Lat_Specs,
> beta2_1, NA
> Lat_Env -> Lat_Design,
> beta3_1, NA
> Lat_Specs -> Lat_Env,
> beta1_2, NA
> Lat_Specs -> Lat_Design,
> beta3_2, NA
> Lat_Design -> Lat_Env,
> beta1_3, NA
> Lat_Design -> Lat_Specs,
> beta1_2, NA
>
> Lat_Env -> Operating_Rating, NA,
> 1
> Lat_Env -> Deck_Cond_Rating,
> lamy2_1, NA
> Lat_Env -> Superstructure_Cond_Rating,
> lamy3_1, NA
> Lat_Env -> Substructure_Cond_Rating,
> lamy4_1, NA
> Lat_Specs -> Operating_Rating, NA,
> 1
> Lat_Specs -> Deck_Cond_Rating,
> lamy2_2, NA
> Lat_Specs -> Superstructure_Cond_Rating,
> lamy3_2, NA
> Lat_Specs -> Substructure_Cond_Rating,
> lamy4_2, NA
> Lat_Design -> Operating_Rating, NA,
> 1
> Lat_Design -> Deck_Cond_Rating,
> lamy2_3, NA
> Lat_Design -> Superstructure_Cond_Rating,
> lamy3_3, NA
> Lat_Design -> Substructure_Cond_Rating,
> lamy4_3, NA
>
> Lat_Env <-> Lat_Specs,
> psi2_1, NA
> Lat_Env <-> Lat_Design,
> psi3_1, NA
> Lat_Specs <-> Lat_Design,
> psi3_2, NA
> Lat_Env <-> Lat_Env,
> psi1_1, NA
> Lat_Specs <-> Lat_Specs,
> psi2_2, NA
> Lat_Design <-> Lat_Design,
> psi3_3, NA
>
> Operating_Rating <-> Operating_Rating,
> thesp1, NA
> Deck_Cond_Rating <-> Deck_Cond_Rating,
> thesp2, NA
> Superstructure_Cond_Rating <->
> Superstructure_Cond_Rating, thesp3, NA
> Substructure_Cond_Rating <-> Substructure_Cond_Rating,
> thesp4, NA
>
> Average_Daily_Traffic <-> Average_Daily_Traffic,
> theps5, NA
> Average_Daily_Truck_Traffic <->
> Average_Daily_Truck_Traffic, thesp6, NA
> Design_Load <-> Design_Load,
> thesp7, NA
> Type_of_Service_On_Bridge <-> Type_of_Service_On_Bridge,
> thesp8, NA
> Railroad_Beneath <-> Railroad_Beneath,
> thesp9, NA
> Highway_Beneath <-> Highway_Beneath,
> thesp10, NA
> Main_Structure_Material <-> Main_Structure_Material,
> thesp11, NA
> Main_Structure_Design <-> Main_Structure_Design,
> thesp12, NA
> Number_of_Spans_In_Main_Unit <->
> Number_of_Spans_In_Main_Unit, thesp13, NA
> BridgeAges <-> BridgeAges,
> thesp14, NA
> Length_of_Maximum_Span <-> Length_of_Maximum_Span,
> thesp15, NA
>
> ===================================
> Result from traceback():
>
> observed variables:
> [1] "1:Type_of_Service_On_Bridge" "2:BridgeAges"
>
> [3] "3:Average_Daily_Traffic"
> "4:Average_Daily_Truck_Traffic"
> [5] "5:Design_Load" "6:Railroad_Beneath"
>
> [7] "7:Highway_Beneath"
> "8:Main_Structure_Material"
> [9] "9:Main_Structure_Design"
> "10:Length_of_Maximum_Span"
> [11] "11:Number_of_Spans_In_Main_Unit" "12:Operating_Rating"
>
> [13] "13:Deck_Cond_Rating"
> "14:Superstructure_Cond_Rating"
> [15] "15:Substructure_Cond_Rating"
>
> latent variables:
> [1] "16:Lat_Env" "17:Lat_Specs" "18:Lat_Design"
>
> parameters:
> [1] "1:gam1_1" "2:gam1_2" "3:gam1_3" "4:gam2_1" "5:gam2_2"
> [6] "6:gam2_3" "7:gam2_4" "8:gam2_5" "9:gam3_1" "10:gam3_2"
> [11] "11:gam3_4" "12:gam3_5" "13:gam3_6" "14:beta2_1" "15:beta3_1"
> [16] "16:beta1_2" "17:beta3_2" "18:beta1_3" "19:lamy2_1" "20:lamy3_1"
> [21] "21:lamy4_1" "22:lamy2_2" "23:lamy3_2" "24:lamy4_2" "25:lamy2_3"
> [26] "26:lamy3_3" "27:lamy4_3" "28:psi2_1" "29:psi3_1" "30:psi3_2"
> [31] "31:psi1_1" "32:psi2_2" "33:psi3_3" "34:thesp1" "35:thesp2"
> [36] "36:thesp3" "37:thesp4" "38:theps5" "39:thesp6" "40:thesp7"
> [41] "41:thesp8" "42:thesp9" "43:thesp10" "44:thesp11" "45:thesp12"
> [46] "46:thesp13" "47:thesp14" "48:thesp15"
>
> RAM:
> heads to from parameter start
> [1,] 1 16 3 1 NA
> [2,] 1 16 4 2 NA
> [3,] 1 16 2 3 NA
> [4,] 1 17 5 4 NA
> [5,] 1 17 1 5 NA
> [6,] 1 17 6 6 NA
> [7,] 1 17 2 7 NA
> [8,] 1 17 7 8 NA
> [9,] 1 18 8 9 NA
> [10,] 1 18 9 10 NA
> [11,] 1 18 10 11 NA
> [12,] 1 18 11 12 NA
> [13,] 1 18 2 13 NA
> [14,] 1 17 16 14 NA
> [15,] 1 18 16 15 NA
> [16,] 1 16 17 16 NA
> [17,] 1 18 17 17 NA
> [18,] 1 16 18 18 NA
> [19,] 1 17 18 16 NA
> [20,] 1 12 16 0 1
> [21,] 1 13 16 19 NA
> [22,] 1 14 16 20 NA
> [23,] 1 15 16 21 NA
> [24,] 1 12 17 0 1
> [25,] 1 13 17 22 NA
> [26,] 1 14 17 23 NA
> [27,] 1 15 17 24 NA
> [28,] 1 12 18 0 1
> [29,] 1 13 18 25 NA
> [30,] 1 14 18 26 NA
> [31,] 1 15 18 27 NA
> [32,] 2 17 16 28 NA
> [33,] 2 18 16 29 NA
> [34,] 2 18 17 30 NA
> [35,] 2 16 16 31 NA
> [36,] 2 17 17 32 NA
> [37,] 2 18 18 33 NA
> [38,] 2 12 12 34 NA
> [39,] 2 13 13 35 NA
> [40,] 2 14 14 36 NA
> [41,] 2 15 15 37 NA
> [42,] 2 3 3 38 NA
> [43,] 2 4 4 39 NA
> [44,] 2 5 5 40 NA
> [45,] 2 1 1 41 NA
> [46,] 2 6 6 42 NA
> [47,] 2 7 7 43 NA
> [48,] 2 8 8 44 NA
> [49,] 2 9 9 45 NA
> [50,] 2 11 11 46 NA
> [51,] 2 2 2 47 NA
> [52,] 2 10 10 48 NA
> Error in solve.default(C[ind, ind]) : Lapack routine dgesv:
> system is exactly singular
>
>
>
>
> ----- Original Message -----
> From: adschai at optonline.net
> Date: Sunday, April 15, 2007 1:19 pm
> Subject: Re: [R] Fit sem model with intercept
> To: r-help at stat.math.ethz.ch
>
> > Thank you John. I got it now.
> > Regarding the model I specified below, I totally agree with you.
> > I listed only portions of my model the illustrate the point of my
> > questions. Therefore, I showed only the arrow part. No correlations
> > are listed here. However, I have those in my complete model.
> > Thank you so much for your help. It was really helpful.
> >
> > - adschai
> >
> > ----- Original Message -----
> > From: John Fox
> > Date: Sunday, April 15, 2007 8:31 am
> > Subject: RE: [R] Fit sem model with intercept
> > To: adschai at optonline.net
> > Cc: r-help at stat.math.ethz.ch
> >
> > > Dear adschai,
> > >
> > > You needn't look too far, since the last example in ?sem is
> > for
> > > a model with
> > > an intercept. One would use the raw-moment matrix as
> input to sem(),
> > > either entered directly or calculated with the raw.moments()
> > > function in the sem package. The row/column of the
> raw-moment matrix
> > > is given a
> > name
> > > just like
> > > the other columns. You could use the name "1"; in the
> example, the
> > > name is "UNIT".
> > >
> > > As you say, however, you're using polychoric and polyserial
> > > correlations as input. Since the origin and scale of the latent
> > > continuous variables underlying the ordinal variables are
> entirely
> > > arbitrary, I
> > can't
> > > imaginewhat the purpose of a model with an intercept
> would be, but
> > > it's possible that I'm missing something. If you think that this
> > > makes some sense, then you could convert the correlations to raw
> > > moments by using the means and standard deviations of the
> observed
> > > variables along with the means and standard deviations that you
> > > assign to the latent variables derived from the ordinal variables
> > > (the latter on what basis I can't imagine,
> > but
> > > I suppose
> > > you could fix them to 0s and 1s).
> > >
> > > Finally, if the sem model that you show is meant to be a complete
> > > specification, I notice that it includes no covariance
> components;
> > > moreover, if this is the complete structural part of the
> model, then
> > > I think it is underidentified, and the two parts of the
> model (those
> > involving
> > > eta1 and
> > > eta2) appear entirely separate.
> > >
> > > I hope this helps,
> > > John
> > >
> > > --------------------------------
> > > John Fox
> > > Department of Sociology
> > > McMaster University
> > > Hamilton, Ontario
> > > Canada L8S 4M4
> > > 905-525-9140x23604
> > > http://socserv.mcmaster.ca/jfox
> > > --------------------------------
> > >
> > > > -----Original Message-----
> > > > From: r-help-bounces at stat.math.ethz.ch
> > > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> > > > adschai at optonline.net
> > > > Sent: Sunday, April 15, 2007 4:28 AM
> > > > To: r-help at stat.math.ethz.ch
> > > > Subject: [R] Fit sem model with intercept
> > > >
> > > > Hi - I am trying to fit sem model with intercepts. Here
> is what I
> > > > have in my model.
> > > >
> > > > Exogeneous vars: x1 (continous), x2 (ordinal), x3 (ordinal),
> > > > x4(continuous) Endogeneous vars: y1 (continuous), y2
> (ordinal), y3
> > > > (ordinal)
> > > >
> > > > SEM model:
> > > > x1 -> eta1; x2 -> eta1; x3 -> eta2; x4 -> eta2; eta1 ->
> y1, eta1
> > > > -> y2, eta2 -> y2, eta2 -> y3
> > > >
> > > > However, in these arrow models, I don't know how to add
> intercept
> > > > onto it. I am trying to find an example code using sem
> package on
> > > > how to incorporate intercept but cannot find any
> documents on the
> > > > web. Or we can simply add something
> > like
> > > > this? '1 -> eta1'? This is my first question.
> > > >
> > > > Also, note that since my y2 and y3 are ordinal, I used the
> > > > 'hetcor' to calculate correlation of observed variables.
> > > > However, from the document, I would need to use the covariance
> > > > matrix rather then the correlation. And I need
> additional column
> > > > for 1. I am not sure how this matrix
> > should
> > > > look like and how I can obtain this? If there is any
> example you
> > > > could point me to, I would really appreciate. Thank you.
> > > >
> > > > - adschai
> > > >
> > > > [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > R-help at stat.math.ethz.ch 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.
> > > >
> > >
> > >
> > >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
More information about the R-help
mailing list