Beta回归分为两组

时间:2017-11-16 15:25:15

标签: r matrix

我正在尝试对包含两个组(控件和案例)的数据集进行beta回归。

           Normal.01 Normal.05 Normal.11 Normal.15 Normal.18 Normal.20 Normal.21 Normal.22 Normal.24 Normal.57
cg00000029   0.32605   0.28981   0.25767   0.26599   0.29924   0.27242   0.22222   0.28861   0.43764   0.26827
cg00000108   0.89785   0.89931   0.90689   0.89893   0.89284   0.90849   0.89940   0.89895   0.89720   0.91092
cg00000109   0.73910   0.72506   0.77163   0.75909   0.75974   0.76260   0.72887   0.80707   0.82701   0.73839
cg00000165   0.30960   0.29963   0.27489   0.30317   0.33740   0.27898   0.25004   0.42462   0.35888   0.30372
cg00000236   0.80654   0.81649   0.83556   0.81778   0.83017   0.84248   0.80569   0.86252   0.78328   0.81349
cg00000289   0.60874   0.62527   0.66264   0.71451   0.69799   0.68689   0.69102   0.61141   0.65301   0.66338
cg00000292   0.63333   0.69221   0.65881   0.64388   0.67124   0.69975   0.65229   0.63081   0.77145   0.62670
cg00000321   0.29422   0.34968   0.30429   0.30094   0.34405   0.29393   0.32035   0.30959   0.52361   0.28215
cg00000363   0.31460   0.27089   0.23656   0.23853   0.26131   0.18052   0.22021   0.35100   0.36632   0.23289
cg00000622   0.02190   0.03480   0.02973   0.03370   0.03124   0.03501   0.03951   0.02815   0.02684   0.03465

前10列是控件,最后62列是大小写。

以下是对beta回归的尝试:

group<-c(rep(0,10),rep(1,62))

group<-t(group)
n<-dim(beta_values)[1]
x<-cbind(beta_values[,1:10], beta_values[,11:72])

pvalues<-rep(0,n)

for(i in 1:n){

  model<-betareg(as.matrix(x[i,])~as.factor(group))
  pvalues[i]<-summary(model)$coefficients$mean[2,4]

}

我收到的错误讯息:

    Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs, data = data,  : 
  variable lengths differ (found for 'as.factor(group)')

我正在使用的数据集:

ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE37nnn/GSE37754/suppl/GSE37754_non-normalized.txt.gz

编辑:

前两行x:

           Normal.01 Normal.05 Normal.11 Normal.15 Normal.18 Normal.20 Normal.21 Normal.22 Normal.24 Normal.57 Tumor.01
cg00000029   0.32605   0.28981   0.25767   0.26599   0.29924   0.27242   0.22222   0.28861   0.43764   0.26827  0.58762
cg00000108   0.89785   0.89931   0.90689   0.89893   0.89284   0.90849   0.89940   0.89895   0.89720   0.91092  0.92337
           Tumor.02 Tumor.03 Tumor.04 Tumor.05 Tumor.06 Tumor.07 Tumor.08 Tumor.09 Tumor.10 Tumor.11 Tumor.12 Tumor.14
cg00000029  0.24012  0.22941  0.21687  0.21251  0.31149  0.44732  0.29103  0.25807  0.36930  0.34509  0.51639  0.65543
cg00000108  0.92256  0.92709  0.92221  0.89395  0.91425  0.91898  0.89680  0.91437  0.89951  0.89193  0.90456  0.90954
           Tumor.16 Tumor.17 Tumor.18 Tumor.19 Tumor.20 Tumor.21 Tumor.23 Tumor.24 Tumor.25 Tumor.26 Tumor.27 Tumor.28
cg00000029  0.17606  0.35455  0.18167  0.28175  0.23622  0.46089  0.29058  0.26638  0.44190  0.31124  0.43802  0.28132
cg00000108  0.90690  0.90970  0.90603  0.91548  0.90875  0.91662  0.91056  0.88788  0.91078  0.91458  0.90931  0.89668
           Tumor.29 Tumor.30 Tumor.31 Tumor.32 Tumor.33 Tumor.34 Tumor.35 Tumor.36 Tumor.38 Tumor.39 Tumor.41 Tumor.42
cg00000029  0.24104  0.38091  0.27517  0.37003  0.29224  0.32397  0.23482  0.22016  0.37136  0.29407  0.24363  0.34096
cg00000108  0.91568  0.87454  0.90568  0.89252  0.91243  0.90080  0.91220  0.87859  0.89292  0.87183  0.90030  0.90473
           Tumor.43 Tumor.44 Tumor.45 Tumor.46 Tumor.47 Tumor.48 Tumor.49 Tumor.50 Tumor.51 Tumor.52 Tumor.54 Tumor.55
cg00000029  0.35800  0.52592  0.45570  0.16679  0.43216  0.18037  0.34484  0.33328  0.32530  0.12381  0.45205  0.35937
cg00000108  0.91372  0.91950  0.91158  0.90271  0.90735  0.92654  0.92322  0.89788  0.88194  0.90243  0.91378  0.91552
           Tumor.58 Tumor.60 Tumor.61 Tumor.62 Tumor.63 Tumor.64 Tumor.65 Tumor.66 Tumor.67 Tumor.68 Tumor.69 Tumor.72
cg00000029  0.20225  0.37377  0.29465  0.55278  0.43761  0.39908  0.28128  0.31136  0.23631  0.28696  0.48497  0.34235
cg00000108  0.92908  0.90524  0.87337  0.90268  0.91282  0.91337  0.92986  0.92723  0.89658  0.86407  0.91670  0.91082
           Tumor.73
cg00000029  0.26999
cg00000108  0.90307

0 个答案:

没有答案