Error "Data names and covariance matrix names do not match"

124 views
Skip to first unread message

Sam P

unread,
Apr 11, 2024, 12:55:52 PM4/11/24
to geomorph R package
Hello!

I am hoping a member of this group knows how to overcome this error "Data names and covariance matrix names do not match" which is traced back to the .lm.rrpp function used by several other functions including lm.rrpp and procD.gls. My lab has code that worked previously with these functions but now gives us this error and any new attempts also give us this error. The name.check function in geiger confirms that the data and phylogeny names match. Does anyone have any insights as to what may be going on?

For example, we have the vcv matrix from the phylogeny reeftr (trvcv) and two traits (cp7 and sl), one of which is a factor (cp7) .

name.check(reeftr,cp7)
"OK"
name.check(reeftr,sl)
"OK"
trvcv<-vcv(reeftr)

rdf <- rrpp.data.frame(x = cp7, y = sl)
sl_allpat <- lm.rrpp(y~x, SStype="I", Cov = trvcv, data = rdf, iter= 999)

->"Error: Data names and covariance matrix names do not match"

Interestingly, if we don't use rrpp.data.frame and use the named vectors instead we get a slightly different error, which also traces back to the .lm.rrpp function

sl_allpat <- lm.rrpp(sl~cp7, SStype="I", Cov = trvcv, data = NULL, iter= 999)

-> "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent"

We get the same error if Cov=NULL as well.  Then to compound it, if we re-run the code using the rrpp.data.frame now we no longer get  "Error: Data names and covariance matrix names do not match" and instead get "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent". So the function is potentially being influenced by something from the R environment? This happens with different datasets and on different machines, so I feel like we are missing something simple!

Thanks - any help would be much appreciated!
Sam

Mike Collyer

unread,
Apr 11, 2024, 2:43:28 PM4/11/24
to geomorph R package
Dear Sam,

Can you indicate which versions of RRPP and geomorph you are using?  I could not replicate your errors with simulated data but I think this might have been something we already fixed.  An update would have to be installed via Github.  If you have version 2.0.0 of RRPP rather than 2.0.1, this might be the problem.  If this is not the problem, might there be some missing data?  I was able to produce a similar error if I changed one of the simulated data values to NA.  This would make sense because once the datum is removed, there are N - 1 data names despite N tree tip labels, even though the data frame had a slot for one taxon.  The name.check function still thinks things are okay because it only checks the labels, not the labels of data that are eventually used in the model fit.

Regarding the different errors, they are basically the same, but one message is because the problem eluded the established traps and triggered one of the default R error messages, instead.  The second error message though suggests the missing data option could be the problem.

Best,
Mike

--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/66b7d225-6dd3-44a7-99b2-82e039dc55b3n%40googlegroups.com.

Sam P

unread,
Apr 18, 2024, 10:14:47 AM4/18/24
to geomorph R package
Thanks Mike! Sorry it took a while to get back to you. We are using RRPP 2.0.0 so it sounds like updating is my best option right now, however I am not seeing 2.0.1. on your github just 2.0.0. I will also check for NA's as it is possible some crept in as we usually have 1000's of data points to keep track of! Sam
Reply all
Reply to author
Forward
0 new messages