我将这些数据保存在名为data.frame
的{{1}}中。
df
我运行这个模型:
"nothing" "SNP" "Site" "Color" "Frequence"
"19595089" "scaffold9976|size55684_51259" "Katiu" "Green" 0.153846153846154
"41766717" "scaffold9976|size55684_51259" "Gambier" "Green" 0.149532710280374
"63938345" "scaffold9976|size55684_51259" "Gambier" "Red" 0.102803738317757
"86109973" "scaffold9976|size55684_51259" "Katiu" "Yellow" 0.1
"108281601" "scaffold9976|size55684_51259" "Takapoto" "Yellow" 0.0465116279069767
"130453229" "scaffold9976|size55684_51259" "Hatchery" "Red" 0.0459770114942529
"152624857" "scaffold9976|size55684_51259" "Gambier" "Yellow" 0.123893805309735
"174796485" "scaffold9976|size55684_51259" "Takapoto" "Red" 0.0476190476190476
"196968113" "scaffold9976|size55684_51259" "Katiu" "Red" 0.076271186440678
"219139741" "scaffold9976|size55684_51259" "Takapoto" "Green" 0.0957446808510638
"241311369" "scaffold9976|size55684_51259" "Hatchery" "Yellow" 0.0705882352941176
"263482997" "scaffold9976|size55684_51259" "Hatchery" "Green" 0.121212121212121
某些p值很重要:
library(multcomp)
SNP_name <- as.character(unique(df$SNP)[11])
ok <- filter(df, df$SNP == unique(df$SNP)[11])
mod <- glm(Frequence ~ Color + Site, data = ok)
K1 <- glht(mod, mcp(Color = "Tukey"))$linfct
K2 <- glht(mod, mcp(Site = "Tukey"))$linfct
pvaleur <- summary(glht(mod, linfct = rbind(K1, K2)))$test$pvalues[1:9]
但是第一个比较显示的pvalue小于其他值:
> summary(glht(mod, linfct = rbind(K1, K2)))
Simultaneous Tests for General Linear Hypotheses
Fit: glm(formula = Frequence ~ Color + Site, data = ok)
Linear Hypotheses:
Estimate Std. Error z value Pr(>|z|)
Red - Green == 0 -0.061916 0.007059 -8.771 < 1e-04 ***
Yellow - Green == 0 -0.044835 0.007059 -6.352 < 1e-04 ***
Yellow - Red == 0 0.017081 0.007059 2.420 0.11152
Hatchery - Gambier == 0 -0.046151 0.008151 -5.662 < 1e-04 ***
Katiu - Gambier == 0 -0.015371 0.008151 -1.886 0.34344
Takapoto - Gambier == 0 -0.062118 0.008151 -7.621 < 1e-04 ***
Katiu - Hatchery == 0 0.030780 0.008151 3.776 0.00133 **
Takapoto - Hatchery == 0 -0.015967 0.008151 -1.959 0.30122
Takapoto - Katiu == 0 -0.046747 0.008151 -5.735 < 1e-04 ***
实际上,出于解释原因here,例如,如果指数太“大”,则R使用 $pvalues
[1] 0.000000e+00 1.336467e-09 1.114732e-01 9.550331e-08 3.434281e-01 1.207923e-13 1.406660e-03 3.012392e-01
[9] 1.276309e-07
(或0
)而不是0.000000e+00
。
但是我需要确切地知道“此指数的数量”。
有很多线程可以解释如何在统计here,here或here之类的统计之后显示科学计数法。
1e-400
或这个
options(scipen = 0)
options(digits = 2)
但这只能给出:
format(pvaleur, scientific = TRUE)
那么,如何强制测试不获得 [1] 0.0e+00 1.4e-09 1.1e-01 1.1e-07 3.4e-01 1.5e-13 1.3e-03 3.0e-01 5.8e-08
而是“真实” pvalue?
任何帮助我编码的建议将不胜感激
编辑:
0.0e+00