I'm making some CCA plots based on 16S microbiome data and have run into an issue where the vif.cca function is only giving values for about half the variables and NAs for all the others. Running the function with only the values that produced NAs produced actual values. I attempted to move forward with the plots anyway, but only one of the two sets of data I was looking at worked; the other spit out an error message during ordistep function.
Here is the code for one of the models:
ccamodel <- cca(dat.ra~., metadata[,c(5:18)])
vif.cca(ccamodel)
C.Al C.As C.Cd C.Co C.Cu C.Fe C.Mn C.Mo
8209.10944 62.45001 29.47413 1858.44566 1183.49583 2680.69957 547.19467 151.96578
C.Ni C.Pb C.Se C.Sn C.V C.Zn
130.85638 NA NA NA NA NA
Re-ran with just the variables that produced NAs:
ccamodel2 <- cca(dat.ra~., metadata[,c(14:18)]) #re-ran with just NAs
vif.cca(ccamodel2)
C.Pb C.Se C.Sn C.V C.Zn
49.31645 22.68222 37.62568 23.85968 16.42651
Code for the ordistep:
finalmodel<- ordistep(ccamodel, scope=formula(ccamodel))
vif.cca(finalmodel)
C.Al C.As C.Cd C.Co C.Cu C.Fe C.Mn C.Mo
8209.10944 62.45001 29.47413 1858.44566 1183.49583 2680.69957 547.19467 151.96578
C.Ni C.Pb C.Se C.Sn C.V C.Zn
130.85638 NA NA NA NA NA
Error for the ordistep for the second set of data:
geofinalmodel<- ordistep(ccamodel, scope=formula(geoccamodel))
Error in factor.scope(ffac, list(add = fadd, drop = fdrop)) : upper scope has terms ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’, ‘NA’ not included in model