procD.lm cannot do fitting for all models

147 views
Skip to first unread message

dan...@berkeley.edu

unread,
Jul 21, 2017, 11:43:11 PM7/21/17
to geomorph R package
Hi,

I am trying to use procD.lm() and see the performance of several nested models
I have 6 independent variables: populations, sex, haplotypes, genotypes, climate PC1 and climate PC2.
When I fit each independent variable separately or some combination of them(e.g. Shape~pop, Shape~climate PC1 or Shape~sex*climate PC1*climate PC2 etc), the function works just fine. 

However, some models (e.g. Shape~populations*climate PC1 or Shape~sex*haplotypes*genotypes*climate PC1*climate PC2 etc), the function would give me an error message:

Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
  'data' must be of a vector type, was 'NULL'

Since models with single independent variable works just fine, I don't think the issue lies in the input matrix. I could be wrong.

Please let me know if you have a thought on this issue.
Thank you very much! 

Dana

Mike Collyer

unread,
Jul 23, 2017, 8:55:28 AM7/23/17
to dan...@berkeley.edu, geomorph R package
Dana,

This error is a base R error but what is causing it to happen is not clear. The only thing that jumps out as a possible explanation is that the design matrix you are attempting to create is rather ridiculous. The number of parameters needed for all two-way, three-way, four-way, five-way, and six-way interactions should be so numerous to believe that there are no redundancies. Climate and population looks to be suspicious. I doubt you populations experience all levels of climate. So why have them interact?  Haplotypes and genotypes are two others where variable interactions make little sense. 

Although we try to anticipate problems with this function, some - like the analysis you are attempting - are not easy to anticipate. We could try to get to the heart of the analytical issue, but I am pretty sure it will be because of your illogical model design. In this case, I think a better question to explore is why you want to have all of these variable interactions?  It simply does not make much sense from a model design perspective. 

In summary, I think your illogical variable interactions led to a model design matrix that could not be decomposed via QR decomposition or had no rank or something like this. The R error basically says, "An attempt to summarize something that contained nothing failed."  

My guess is because of those illogical interactions creating many columns of nothingness in your design matrix. 

Mike

Sent from my iPhone
--
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 post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/b92f0b1d-a45a-421b-a724-5c02acd56611%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages