您好,我正在尝试计算faraway
包中的方差通胀因子(vif)。我对R很新,所以请耐心等待。
这是我的数据集:
str(SMB)
'data.frame': 1266 obs. of 30 variables:
$ X2011 : int 550 547 543 546 544 548 545 549 42 49 ...
$ CatchID : num 0.5 0.2 0.6 0.1 0.7 0.3 0.8 0.4 1 2 ...
$ StomachID : int 5 2 6 1 7 3 8 4 NA 304 ...
$ Date : Factor w/ 68 levels "2011-06-18","2011-06-22",..: 1 1 1 1 1 1 1 1 43 43 ...
$ Lake : Factor w/ 9 levels "Beaver Lake",..: 6 6 6 6 6 6 6 6 1 1 ...
$ Year : int 2011 2011 2011 2011 2011 2011 2011 2011 2012 2012 ...
$ Site. : int 1 1 1 1 1 1 1 1 1 2 ...
$ Set. : int 0 0 0 0 0 0 0 0 1 2 ...
$ SampleMeth : Factor w/ 3 levels "GN","MN","SG": 1 1 1 1 1 1 1 1 1 1 ...
$ Habitat : Factor w/ 6 levels "","BARE","MIX",..: 3 3 3 3 3 3 3 3 1 6 ...
$ DegDays : int 209 209 209 209 209 209 209 209 NA 155 ...
$ Weight.g. : num 1093 635 1583 607 1651 ...
$ Length.mm. : num 453 360 480 345 480 373 482 400 195 269 ...
$ CondFactor : Factor w/ 147 levels "#DIV/0!","0",..: 47 65 72 77 78 79 82 88 84 61 ...
$ Age : num NA NA NA NA NA NA NA NA NA 2.3 ...
$ Species : Factor w/ 6 levels "CT","KO","PMB",..: 5 5 5 5 5 5 5 5 5 5 ...
$ Fish..Set : int 8 8 8 8 8 8 8 8 4 4 ...
$ SppDiv.Set : int 1 1 1 1 1 1 1 1 1 1 ...
$ Fish..Spp.Set: int 8 8 8 8 8 8 8 8 1 3 ...
$ Soak.Hrs. : num 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 2.02 2.02 ...
$ CT_CPUE : num 0 0 0 0 0 0 0 0 0 0 ...
$ RB_CPUE : num 0 0 0 0 0 0 0 0 0 0 ...
$ SMB_CPUE : num 6.67 6.67 6.67 6.67 6.67 6.67 6.67 6.67 0.5 1.49 ...
$ KOK.CPUE : num 0 0 0 0 0 0 0 0 0 0 ...
$ YP.CPUE : Factor w/ 21 levels "#DIV/0!","0",..: 2 2 2 2 2 2 2 2 2 2 ...
$ PMB.CPUE : num 0 0 0 0 0 0 0 0 0 0 ...
$ TotalEn : num 33894 892 32386 1901 32764 ...
$ PreyDiv : int 1 2 1 5 1 3 1 2 NA 1 ...
$ CrayPresent : int 0 0 0 0 0 0 0 0 0 0 ...
$ CrayAbund : num 0 0 0 0 0 0 0 0 0 0 ...
vif(SMB[,-30]) or vif(SMB)
当我尝试计算vif时,我收到此错误:
[[<-.data.frame
(*tmp*
,i,值= c(47L,58L,161L,147L, :替换有5180行,数据有185个
值和替换行每次都不同。有谁知道我应该做什么?
谢谢你, DEZ