Error in cov(eXo[[g]]... Ideas why?

2,113 views
Skip to first unread message

MB

unread,
Jan 22, 2015, 11:59:16 AM1/22/15
to lav...@googlegroups.com
Hi All,

I've come across an error when trying to do the following model:

my.data<-data.frame(A=A,C=C,D=D)
my.model<-"
C~D
A~C+D
"
fit.mine<-sem(my.model,data=my.data,fixed.x=FALSE, std.ov = TRUE)

Produces this error:

Error in cov(eXo[[g]], use = "pairwise") : 
  supply both 'x' and 'y' or a matrix-like 'x'


The error disappears when std.ov is set to false, but this is not ideal.

I have also tried decostand(my.data, method="standardize") from vegan and while that will compute, it gives strange results when that matrix is put into lavaan.

Thanks very much for insight,
Michael

Yves Rosseel

unread,
Jan 23, 2015, 4:09:50 AM1/23/15
to lav...@googlegroups.com
> *my.data<-data.frame(A=A,C=C,D=D)*
> *my.model<-"*
> *C~D*
> *A~C+D*
> *"*
> *fit.mine<-sem(my.model,data=my.data,fixed.x=FALSE, std.ov = TRUE)*
>
> Produces this error:
>
> *Error in cov(eXo[[g]], use = "pairwise") : *
> * supply both 'x' and 'y' or a matrix-like 'x'*

That is a bug. It only appears if std.ov=TRUE, and there is exactly 1
exogenous variable in the model.

The workaround in 0.5-17 is to standardized your variables before the
analysis.

Fixed in dev 0.5-18.772

Yves.

Michael Becker

unread,
Jan 23, 2015, 9:34:29 AM1/23/15
to lav...@googlegroups.com
Thanks for the quick reply Yves.

Is dev 0.5-18.772 available yet? I didn't see it on the lavaan project website.

Also you are correct - standardizing (in this case using decostand(method="standardize")) before analysis works. But you cannot use the std.ov argument at all, either true or false, or lavaan gets unhappy.





--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/8SK3Y770YaY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Yves Rosseel

unread,
Jan 23, 2015, 9:37:30 AM1/23/15
to lav...@googlegroups.com
On 01/23/2015 03:34 PM, Michael Becker wrote:
> Thanks for the quick reply Yves.
>
> Is dev 0.5-18.772 available yet? I didn't see it on the lavaan project
> website.

You can install it as follows:

install.packages("lavaan", repos = "http://www.da.ugent.be", type =
"source")

Yves.

Michael Becker

unread,
Jan 23, 2015, 9:44:18 AM1/23/15
to lav...@googlegroups.com
Great, thank you. std.ov=T is now working on my models that had the bug.



Yves.

s....@irri.org

unread,
Dec 25, 2017, 1:27:23 AM12/25/17
to lavaan
The following is my error.

Error in cor(Ratings, method = "pearson", use = "complete.obs") : 
  supply both 'x' and 'y' or a matrix-like 'x'



s....@irri.org

unread,
Dec 25, 2017, 1:30:09 AM12/25/17
to lavaan
this is my error:

Error in cor(Ratings, method = "pearson", use = "complete.obs") : 
  supply both 'x' and 'y' or a matrix-like 'x'



Terrence Jorgensen

unread,
Jan 5, 2018, 7:41:33 AM1/5/18
to lavaan
The following is my error.

Error in cor(Ratings, method = "pearson", use = "complete.obs") : 
  supply both 'x' and 'y' or a matrix-like 'x'

The error message speaks for itself, but cor() is not a function in the lavaan package, so this is not a lavaan issue.  You can post general R questions on the Stack Exchange for statistics, called Cross Validated:


Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages