Re: [R] lavaan diagram

From: William Revelle <>
Date: Tue, 08 Mar 2011 22:05:56 -0600


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:
>>Error in strwidth(xvars) : 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

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.


>Peter Ehlers
> mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 Mar 2011 - 04:11:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Mar 2011 - 04:20:20 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive