[R] Structural equation modeling in R(lavaan,sem)

John Fox jfox at mcmaster.ca
Mon Mar 28 21:41:22 CEST 2011


Dear jouba,

I think you're using the sem() function in the sem package.

I'm not sure that I understand your question, but I think it is why you need to specify the variance of the exogenous variable x1 as a parameter. The answer is that it is a parameter to be estimated from the data, but you can avoid specifying it explicitly by using the fixed.x argument to sem().

I hope this helps,
 John

On Mon, 28 Mar 2011 09:00:05 -0700 (PDT)
 jouba <antrael at hotmail.com> wrote:
> 
>  
> Dear all ,
> I am trying to run sem by an example with my data but i have problme with an  exogen variable  x1 so my examlpe is below 
> when i add i the equation we have no pboblem but i don’t know why ??
>  
> x1 <->x1, sigmma7, NA
> for me this  an exogen variable and i am not obliged to specify this equation
>  
> model.se<-specify.model()
> x1->x2,gamm1,NA
> x2->x3,gamm2,NA
> x3>x4,gamm3,NA
> x4->x5,gamm4,NA
> x7->x6,gamm5,NA
> x6->x5,gamm6,NA
> x2 <->x2 ,sigmma1,NA
> x3 <->x3 ,simma2,NA
> x4 <->x4 ,sigmma3,NA
> x5 <->x5 ,sigmma4,NA
> x7 <->x7 ,sigmma5,NA
> x6 <->x6 ,sigmma6,NA
>  
> sem.se <- sem(model.se, cov(se), 245) 
> Erreur dans solve.default(C) : 
>   sous-programme Lapack dgesv : le système est exactement singulier
> De plus : Message d'avis :
> In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars,  :
>   The following variables have no variance or error-variance parameter (double-headed arrow):
>  x1 
> The model is almost surely misspecified; check also for missing covariances.
>  
> Thanks a lot 
> 
> 
> Antra EL MOUSSELLY 
> 
> 
>  
> 
> 
> Date: Mon, 28 Mar 2011 05:40:32 -0700
> From: ml-node+3411579-510061861-225466 at n4.nabble.com
> To: antrael at hotmail.com
> Subject: Re: Structural equation modeling in R(lavaan,sem)
> 
> On 03/28/2011 04:18 AM, jouba wrote: 
> > 
> > Jeremy thanks a lot for your response I have read sem package help 
> > and I currently reading the help of lavaan I see that there is also 
> > an other function called lavaan can do the SEM analysis So I wonder 
> > what is the difference between this function and the sem function 
> 
> The 'sem()' function (in the lavaan package) is more user-friendly, in 
> the sence that it sets a number of reasonable options by default, before 
> calling the lower-level 'lavaan()' function (which has the 'feature' of 
> doing nothing automatically, but expects that you really know what your 
> are doing). 
> 
> Most users should only use the 'sem()' function (or the 'cfa()' 
> function). For non-standard models, the 'lavaan()' function gives more 
> control. 
> 
> > Also I am wondering in the case where we have categorical variables 
> > and discreet variables?? 
> 
> Currently, the lavaan package (0.4-7) has no support for categorical 
> variables. 
> 
> > calculate the correlation matrix , mainly when we have to calculate 
> > these between a quantitative and qualitative variables, I wonder if 
> > polycor package is the best solution for this 
> 
> It depends. The 'hetcor()' function in the polycor package may provide a 
> suitable correlation matrix that can be used with the 'sem' package or 
> the 'lavaan' package. However, AFAIK, the polycor does not compute the 
> corresponding asymptotic weight matrix which you need for getting proper 
> standard errors and test statistics (in a WLS context). 
> 
> The OpenMx package (http://openmx.psyc.virginia.edu/) has some support 
> for categorical (ie binary/ordinal) observed variables (although I'm not 
> sure if they can handle the joint analysis of ordinal and continuous 
> variables yet). 
> 
> But none of this is needed _if_ the categorical variables are all 
> exogenous (ie predictor variables only) in which case you can still use 
> the methods for continuous data. 
> 
> Yves. 
> 
> -- 
> Yves Rosseel -- http://www.da.ugent.be
> Department of Data Analysis, Ghent University 
> Henri Dunantlaan 1, B-9000 Gent, Belgium 
> 
> ______________________________________________ 
> [hidden email] 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. 
> 
> 
> 
> 
> 
> 
> If you reply to this email, your message will be added to the discussion below:http://r.789695.n4.nabble.com/Structural-equation-modeling-in-R-lavaan-sem-tp3409642p3411579.html 
> To unsubscribe from Structural equation modeling in R(lavaan,sem), click here.  		 	   		  
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Structural-equation-modeling-in-R-lavaan-sem-tp3409642p3412181.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[alternative HTML version deleted]]
> 

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/



More information about the R-help mailing list