[R] lavaan diagram

William Revelle lists at revelle.net
Wed Mar 9 05:05:56 CET 2011


Sebastian,

At 7:03 PM -0800 3/8/11, Peter Ehlers wrote:
>On 2011-03-08 18:09, Sebastián Daza wrote:
>>Hi everyone,
>>I got the following error when I tried to diagram a confirmatory factor
>>analysis using lavaan:
>>
>>lavaan.diagram(conf)
>>Error in strwidth(xvars) : plot.new has not been called yet
>>
>>Does anyone have any idea about what is happening?
>>Thank you in advance.
>>
>Two problems with this request:
>1. It would be customary to mention that lavaan.diagram
>    is in the psych package.
>2. Is 'conf' of the appropriate class? Have you checked
>    with str(conf)?


As I said in a previous response to a 
lavaan.diagram question of yours, the currently 
released version of psych was released before 
lavaan 0.4-7 was released.  In an improvement to 
the efficiency of the lavaan,  Yves Rosseel  
changed some of the structure of the output . 
(See his very helpful introduction to lavaan at 
http://lavaan.ugent.be/.)

lavaan.diagram is just a very short function in 
psych that calls structure.diagram (also in 
psych).  Read the documentation for 
structure.diagram to see what it is looking for 
(basically two measurement models and a structure 
model) and then look at the lavann structure to 
see how to pass the appropriate parameters.

Until I release the next version of psych the 
best solution is to look at the current version 
of lavaan.diagram (10 lines of code) and modify 
them to handle the structure of lavaan output.

lavaan is a very nice product and lavaan.diagram 
is a minor attempt to make it even better.

It would help me improve lavaan.diagram if you 
could send me a simple example of the data set 
you were examining and what was the model that 
did not diagram correctly.

I hope that helps.

Bill


>
>Peter Ehlers
>
>______________________________________________
>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.



More information about the R-help mailing list