用于特征选择的方差分析
ANOVA for feature selection
我正在尝试在 R 中使用 ANOVA 执行特征 selection。目前我有一个大矩阵(名为 expressionMarix) 存储我的表达谱的地方和一个代表 4 种疾病的因素(命名为标签)。
表达式矩阵 看起来像这样:
1007_s_at 1053_at 117_at 121_at 1255_g_at
GSM1304852 2.394537 0.10510845 -0.4597124 0.9333566 -0.23991384
GSM1304853 2.275184 0.06160802 -0.5231035 1.1318090 0.10112324
GSM1304854 2.161163 0.34217618 -0.4436059 0.9975700 -0.04087979
GSM1304855 1.964183 0.35939157 -0.6370277 1.0079778 -0.21851374
GSM1304856 2.132253 0.22356958 -0.3511470 0.9720455 -0.29917857
其中列是基因,行是样本。
是否有允许我使用 ANOVA select 相关列的软件包?
我当前的代码如下所示:
modelAnova <- aov(expressionMatrix ~ Labels)
sumAnova <- summary(modelAnova)
pValList <- list()
i = 1
while(i < dim(Mstriat)[1]){
print(i)
pValList[i] <- sumAnova[[i]][["Pr(>F)"]][1]
i <- i+1
}
keepers<-which(cValList<0.05)
但是for循环真的很费时间。有没有更有效的方法?
没有 dput(expressionMarix)
和 dput(Labels)
输出,很难给出完美的答案,但是,我在其他模型上遇到了同样的问题,它对 broom::tidy()
功能有很大帮助。这个想法是在 data.frame
中转换模型,然后只对具有想要的 p.value
的行进行子集化,现在是一列:
library(broom)
# this is going to put in a data.frame the output of the model
inline <- tidy(modelAnova)
# here you filter the p.value <= 0.05
inline[!is.na(inline$p.value <= 0.05),]
我正在尝试在 R 中使用 ANOVA 执行特征 selection。目前我有一个大矩阵(名为 expressionMarix) 存储我的表达谱的地方和一个代表 4 种疾病的因素(命名为标签)。 表达式矩阵 看起来像这样:
1007_s_at 1053_at 117_at 121_at 1255_g_at
GSM1304852 2.394537 0.10510845 -0.4597124 0.9333566 -0.23991384
GSM1304853 2.275184 0.06160802 -0.5231035 1.1318090 0.10112324
GSM1304854 2.161163 0.34217618 -0.4436059 0.9975700 -0.04087979
GSM1304855 1.964183 0.35939157 -0.6370277 1.0079778 -0.21851374
GSM1304856 2.132253 0.22356958 -0.3511470 0.9720455 -0.29917857
其中列是基因,行是样本。
是否有允许我使用 ANOVA select 相关列的软件包? 我当前的代码如下所示:
modelAnova <- aov(expressionMatrix ~ Labels)
sumAnova <- summary(modelAnova)
pValList <- list()
i = 1
while(i < dim(Mstriat)[1]){
print(i)
pValList[i] <- sumAnova[[i]][["Pr(>F)"]][1]
i <- i+1
}
keepers<-which(cValList<0.05)
但是for循环真的很费时间。有没有更有效的方法?
没有 dput(expressionMarix)
和 dput(Labels)
输出,很难给出完美的答案,但是,我在其他模型上遇到了同样的问题,它对 broom::tidy()
功能有很大帮助。这个想法是在 data.frame
中转换模型,然后只对具有想要的 p.value
的行进行子集化,现在是一列:
library(broom)
# this is going to put in a data.frame the output of the model
inline <- tidy(modelAnova)
# here you filter the p.value <= 0.05
inline[!is.na(inline$p.value <= 0.05),]