Closed jonahcullen closed 2 years ago
The goal of colinearityScore()
is to identify if covariates are too closely correlated to get a meaningful model fit.
Let's take a look at the example here: https://gabrielhoffman.github.io/variancePartition/reference/colinearityScore.html?q=colinearityScore
library(variancePartition)
data(varPartData)
form <- ~ Age + (1|Individual) + (1|Tissue)
res <- fitVarPartModel( geneExpr[1:10,], form, info )
colinearityScore(res[[1]])
#> [1] 0.7396999
#> attr(,"vcor")
#> (Intercept) Age
#> (Intercept) 1.0000000 -0.7396999
#> Age -0.7396999 1.0000000
That works as expected.
In your example, it looks like you fit a model with only an intercept term:
form <- ~ 1
res <- fitVarPartModel( geneExpr[1:10,], form, info )
colinearityScore(res[[1]])
#> [1] 0
#> attr(,"vcor")
#> (Intercept)
#> (Intercept) 1
With only an intercept term, there is no collinearity so it returns 0. As far as the correlation matrix here, there is only an intercept so the correlation matrix (which is always 1's on the diagonal) is a single value here.
What do you want from this?
Gabriel
Oops I see the problem - I failed to include the continuous variables in the model. Sorry for the bother!
Hello, I am attempting to assess collinearity as described in section of 4.4 of the manual. I believe I followed the instructions correctly (e.g.
fitExtractVarPartModel(vobjGenes, form, all_meta)
seems to work as expected) but get the following fromcolinearityScore( res[[1]] )
.I am sure I'm missing something or the input is not correct but I've tried a couple different things and cannot seem to get the correlation matrix to return.
Thanks for your time and excellent software!