0

IHi everybody, I have a data frame like this and I would like to estimate the p-values of wilcoxon test each features with the outcome LesionResponse. I have 158 features and 1052 rows in reality, here is a sample :

structure(list(LesionResponse = structure(c(1L,2L,2L,2L,1L,2L), .Label = c("0", "1"), class = "factor"), F1= c(677.0119, 275.281, 582.131, 173.747, 6140.739, 558.277), F2=c(27390, 2818, 9856, 3176, 2312, 9800), F3=c(6573,876,246,432,9840,3455)), row.names = c(NA, -6L), class = c("data.frame"))

I tried this and it works

data->d 
out <- lapply(3:158, function(x) wilcox.test(d[[x]]~d[["LesionResponse"]],p.adjust.method="none"))
names(out) <- names(d)[3:158]
pvalue<-sapply(out, function(x) {
    p <- x$p.value
    n <- outer(rownames(p), colnames(p), paste, sep='v')
    p <- as.vector(p)
    names(p) <- n
    p
})

No problem until then, but I remember that I had to use the tilde between the groups bc LesionResponse is factorial... And when I want to use it, it doesn't work properly... I have an error message :

Error in factor(g) : argument "g" is missing, with no default

Second point, if I want to adjust the results with a Bonferroni or Hochberg methods, do I have to include it in the formula ahead or must I try something like this (someone in other topic gave me this tip) :

pvalue.adj<-pvalue %>%  
  mutate(bonferroni = p.adjust(p_values, method="bonferroni"),
         hochberg = p.adjust(p_values, method="hochberg")) 

Thanks !

EDIT : When I try to plot the p-values and see if there is a "signal", I obtain 2 different hist. One from the unadjusted values, and the other after the adjustment :

Before Plot before

After plot after

EDIT : the results after applying the adjustment methods :

structure(list(p_values = c(0.00551261839474566, 0.00909340979590469, 
0.42610555368556, 0.711610700326496, 0.00439218856215691, 0.859681237958105, 
0.0322260009219256, 0.0223266321957813, 0.00197866202920157, 
0.00477994800259759, 0.0334249080496659, 0.496932919931259, 0.663920668008012, 
0.720881014677754, 0.0297979968697475, 0.0356097832461254, 0.23772033703516, 
0.00577026236757682, 0.162545441087746, 0.00442826785177519, 
0.00099785450266166, 0.68498988949557, 0.293192967274354, 0.0293974699047077, 
0.00563206766105133, 0.0302032059132771, 0.149982419022095, 0.0117650458613236, 
0.00722106228315785, 0.116611904006298, 0.991091764445625, 0.426181786438127, 
0.0199043826307254, 0.282954652537935, 0.316987554008872, 0.287463005642041, 
0.216694242942868, 0.704579097239109, 0.868460019724853, 0.124907555136025, 
0.285674873292479, 0.542242360486498, 0.0496243477586135, 0.0434858534774411, 
0.828736111048383, 0.404474278044785, 0.0182857885511237, 0.563247971274975, 
0.069039904343272, 0.0295710392222569, 0.350230402180736, 0.0333476677735606, 
0.0471644725307717, 0.835450378258624, 0.281809089719096, 0.0148190170909998, 
0.143062207795075, 0.809571403741674, 0.00223024406490939, 0.15084029676645, 
0.00954740541279818, 0.597328323545331, 0.00388241390125827, 
0.00224684189461323, 0.112129605974, 0.336372553788455, 0.00922012229959528, 
0.0142291364628418, 0.00786106491272257, 0.0640588588215927, 
0.00481472587937691, 0.0169223648782023, 0.334563509388565, 0.169225486633685, 
0.00433218047495988, 0.507974814028091, 0.0197199267976459, 0.638868802197835, 
0.578579232627203, 0.115129210688882, 0.187679172955444, 0.0725217812727235, 
0.0250087469037117, 0.554097458962052, 0.642697102116448, 0.594667514157925, 
0.0454440141834236, 0.280562980276798, 0.72942994609021, 0.0507424975671683, 
0.686871123104629, 0.348070903680781, 0.197768595223939, 0.0357938186675636, 
0.157496482709621, 0.414113056030403, 0.00308784663090576, 0.93391216078757, 
0.105111947088333, 0.151701909231863, 0.170600380044832, 0.47258166786548, 
0.628184309536363, 0.576513185026462, 0.778541905073879, 0.223607864384675, 
0.390077835833757, 0.40881483612749, 0.0624828914749001, 0.906122460451701, 
0.259361052718202, 0.246190023601957, 0.128433685722639, 0.265102684695246, 
0.00630500179533843, 0.444802839524387, 0.0361229958938499, 0.640948231734991, 
0.374869594141178, 0.277155494279449, 0.00111793280137301, 0.582083519481722, 
0.826470560637168, 0.120648300746039, 0.175663819169603, 0.0268651857443075, 
0.112655976232758, 0.144400693738675, 0.763066537200817, 0.00348586657185806, 
0.819682705710851, 0.260739015862642, 0.252643392240181, 0.979030507643315, 
0.92051292876482, 0.984596812863137, 0.00410925942091098, 0.608838980589555, 
0.00948307636812433, 0.347836221806216, 0.325498103887913, 0.275820925118883, 
0.14427280683813, 0.0454064102830872, 0.58928209116116, 0.0265147406357855, 
0.253512666966341, 0.700438208394314, 0.0989697994010273, 0.00158179100042023, 
0.0598348384644316, 0.699576637791657, 0.405917968746726, 0.0542533800621536, 
0.0682088213784069, 0.367961409615549), bonferroni = c(0.859968469580323, 
1, 1, 1, 0.685181415696478, 1, 1, 1, 0.308671276555446, 0.745671888405224, 
1, 1, 1, 1, 1, 1, 1, 0.900160929341985, 1, 0.69080978487693, 
0.155665302415219, 1, 1, 1, 0.878602555124008, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 0.347918074125865, 1, 1, 1, 0.605656568596289, 
0.350507335559664, 1, 1, 1, 1, 1, 1, 0.751097237182799, 1, 1, 
1, 0.675820154093741, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 0.481704074421299, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.983580280072796, 1, 1, 1, 
1, 1, 0.17439751701419, 1, 1, 1, 1, 1, 1, 1, 1, 0.543795185209857, 
1, 1, 1, 1, 1, 1, 0.641044469662113, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 0.246759396065555, 1, 1, 1, 1, 1, 1), hochberg = c(0.777279193659138, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.636867341512752, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.302735290467841, 
0.683532564371456, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.802066469093179, 0.991091764445625, 0.637670570655627, 0.155665302415219, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.788489472547187, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.989285532792625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.338997097866227, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.574597257386223, 0.339273126086597, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.683691074871522, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.632498349344142, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.463176994635864, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.870090247756704, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.173279584212817, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.51939411920685, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.604061134873914, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.243595814064715, 0.991091764445625, 0.991091764445625, 0.991091764445625, 
0.991091764445625, 0.991091764445625, 0.991091764445625)), row.names = c("pyrad_tum_original_shape_LeastAxisLength.NA", 
"radiomic_score.NA", "KVP.NA", "SliceThickness.NA", "PixelSpacingX.NA", 
"pyrad_tum_original_shape_Elongation.NA", "pyrad_tum_original_shape_Flatness.NA", 
"pyrad_tum_original_shape_MeshVolume.NA", "pyrad_tum_original_shape_Sphericity.NA", 
"pyrad_tum_original_shape_SurfaceVolumeRatio.NA", "pyrad_tum_original_firstorder_10Percentile.NA", 
"pyrad_tum_original_firstorder_90Percentile.NA", "pyrad_tum_original_firstorder_Kurtosis.NA", 
"pyrad_tum_original_firstorder_Maximum.NA", "pyrad_tum_original_firstorder_Range.NA", 
"pyrad_tum_original_firstorder_Skewness.NA", "pyrad_tum_original_firstorder_Uniformity.NA", 
"pyrad_tum_original_glcm_Autocorrelation.NA", "pyrad_tum_original_glcm_ClusterProminence.NA", 
"pyrad_tum_original_glcm_ClusterShade.NA", "pyrad_tum_original_glcm_Correlation.NA", 
"pyrad_tum_original_glcm_Imc2.NA", "pyrad_tum_original_glcm_JointEnergy.NA", 
"pyrad_tum_original_glrlm_LongRunEmphasis.NA", "pyrad_tum_original_glrlm_ShortRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_original_glszm_LargeAreaEmphasis.NA", "pyrad_tum_original_glszm_SmallAreaEmphasis.NA", 
"pyrad_tum_original_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_original_glszm_ZoneEntropy.NA", "pyrad_tum_original_gldm_LargeDependenceLowGrayLevelEmphasis.NA", 
"pyrad_tum_original_ngtdm_Busyness.NA", "pyrad_tum_original_ngtdm_Contrast.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_firstorder_90Percentile.NA", "pyrad_tum_log.sigma.1.0.mm.3D_firstorder_Maximum.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_firstorder_Skewness.NA", "pyrad_tum_log.sigma.1.0.mm.3D_glcm_ClusterProminence.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_glcm_Correlation.NA", "pyrad_tum_log.sigma.1.0.mm.3D_glcm_Idn.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_glcm_Imc1.NA", "pyrad_tum_log.sigma.1.0.mm.3D_glcm_JointEntropy.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_glrlm_ShortRunEmphasis.NA", "pyrad_tum_log.sigma.1.0.mm.3D_glrlm_ShortRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.1.0.mm.3D_glszm_LowGrayLevelZoneEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_firstorder_Kurtosis.NA", "pyrad_tum_log.sigma.2.0.mm.3D_firstorder_Maximum.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_firstorder_Minimum.NA", "pyrad_tum_log.sigma.2.0.mm.3D_firstorder_Skewness.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_firstorder_Uniformity.NA", "pyrad_tum_log.sigma.2.0.mm.3D_glcm_ClusterProminence.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glcm_ClusterShade.NA", "pyrad_tum_log.sigma.2.0.mm.3D_glcm_Imc2.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glcm_MCC.NA", "pyrad_tum_log.sigma.2.0.mm.3D_glrlm_LongRunEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glrlm_LowGrayLevelRunEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glszm_LargeAreaHighGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glszm_LargeAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glszm_SizeZoneNonUniformity.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_glszm_ZoneEntropy.NA", "pyrad_tum_log.sigma.2.0.mm.3D_glszm_ZoneVariance.NA", 
"pyrad_tum_log.sigma.2.0.mm.3D_ngtdm_Coarseness.NA", "pyrad_tum_log.sigma.3.0.mm.3D_firstorder_90Percentile.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_firstorder_Kurtosis.NA", "pyrad_tum_log.sigma.3.0.mm.3D_firstorder_Skewness.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_firstorder_Variance.NA", "pyrad_tum_log.sigma.3.0.mm.3D_glcm_Autocorrelation.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_glcm_ClusterShade.NA", "pyrad_tum_log.sigma.3.0.mm.3D_glcm_Imc1.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_glcm_Imc2.NA", "pyrad_tum_log.sigma.3.0.mm.3D_glcm_InverseVariance.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_glcm_MCC.NA", "pyrad_tum_log.sigma.3.0.mm.3D_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_glszm_LowGrayLevelZoneEmphasis.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_gldm_DependenceEntropy.NA", "pyrad_tum_log.sigma.3.0.mm.3D_gldm_DependenceNonUniformityNormalized.NA", 
"pyrad_tum_log.sigma.3.0.mm.3D_gldm_DependenceVariance.NA", "pyrad_tum_log.sigma.4.0.mm.3D_firstorder_Entropy.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_firstorder_Maximum.NA", "pyrad_tum_log.sigma.4.0.mm.3D_glcm_ClusterProminence.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glcm_ClusterShade.NA", "pyrad_tum_log.sigma.4.0.mm.3D_glcm_Correlation.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glcm_Idn.NA", "pyrad_tum_log.sigma.4.0.mm.3D_glcm_Imc1.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glcm_JointEnergy.NA", "pyrad_tum_log.sigma.4.0.mm.3D_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glrlm_RunLengthNonUniformityNormalized.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glrlm_ShortRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glszm_LargeAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glszm_SizeZoneNonUniformityNormalized.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glszm_SmallAreaEmphasis.NA", "pyrad_tum_log.sigma.4.0.mm.3D_glszm_SmallAreaHighGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_ngtdm_Busyness.NA", "pyrad_tum_log.sigma.4.0.mm.3D_ngtdm_Coarseness.NA", 
"pyrad_tum_log.sigma.4.0.mm.3D_ngtdm_Strength.NA", "pyrad_tum_log.sigma.5.0.mm.3D_firstorder_10Percentile.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_firstorder_90Percentile.NA", "pyrad_tum_log.sigma.5.0.mm.3D_firstorder_Kurtosis.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_firstorder_Skewness.NA", "pyrad_tum_log.sigma.5.0.mm.3D_glcm_Contrast.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_glcm_Idmn.NA", "pyrad_tum_log.sigma.5.0.mm.3D_glcm_Imc2.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_glcm_InverseVariance.NA", "pyrad_tum_log.sigma.5.0.mm.3D_glcm_JointAverage.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_glszm_SizeZoneNonUniformityNormalized.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_glszm_SmallAreaEmphasis.NA", "pyrad_tum_log.sigma.5.0.mm.3D_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_gldm_DependenceNonUniformityNormalized.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_gldm_LowGrayLevelEmphasis.NA", 
"pyrad_tum_log.sigma.5.0.mm.3D_ngtdm_Busyness.NA", "pyrad_tum_log.sigma.5.0.mm.3D_ngtdm_Coarseness.NA", 
"pyrad_tum_wavelet.LLH_firstorder_90Percentile.NA", "pyrad_tum_wavelet.LLH_firstorder_Kurtosis.NA", 
"pyrad_tum_wavelet.LLH_firstorder_Skewness.NA", "pyrad_tum_wavelet.LLH_glcm_ClusterProminence.NA", 
"pyrad_tum_wavelet.LLH_glcm_ClusterShade.NA", "pyrad_tum_wavelet.LLH_glcm_Correlation.NA", 
"pyrad_tum_wavelet.LLH_glcm_JointEnergy.NA", "pyrad_tum_wavelet.LLH_glcm_MCC.NA", 
"pyrad_tum_wavelet.LLH_glrlm_LongRunEmphasis.NA", "pyrad_tum_wavelet.LLH_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LLH_glrlm_ShortRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LLH_glszm_LargeAreaEmphasis.NA", "pyrad_tum_wavelet.LLH_glszm_LargeAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LLH_glszm_SizeZoneNonUniformityNormalized.NA", 
"pyrad_tum_wavelet.LLH_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LLH_gldm_SmallDependenceHighGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LLH_ngtdm_Contrast.NA", "pyrad_tum_wavelet.LHL_firstorder_90Percentile.NA", 
"pyrad_tum_wavelet.LHL_firstorder_Skewness.NA", "pyrad_tum_wavelet.LHL_glcm_ClusterProminence.NA", 
"pyrad_tum_wavelet.LHL_glcm_ClusterShade.NA", "pyrad_tum_wavelet.LHL_glcm_Correlation.NA", 
"pyrad_tum_wavelet.LHL_glcm_DifferenceVariance.NA", "pyrad_tum_wavelet.LHL_glcm_Idmn.NA", 
"pyrad_tum_wavelet.LHL_glcm_InverseVariance.NA", "pyrad_tum_wavelet.LHL_glcm_JointEntropy.NA", 
"pyrad_tum_wavelet.LHL_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHL_glszm_LargeAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHL_glszm_SmallAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHL_gldm_SmallDependenceHighGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHH_firstorder_Mean.NA", "pyrad_tum_wavelet.LHH_firstorder_Skewness.NA", 
"pyrad_tum_wavelet.LHH_glcm_ClusterProminence.NA", "pyrad_tum_wavelet.LHH_glcm_ClusterShade.NA", 
"pyrad_tum_wavelet.LHH_glcm_Correlation.NA", "pyrad_tum_wavelet.LHH_glcm_Idn.NA", 
"pyrad_tum_wavelet.LHH_glrlm_LongRunLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHH_glszm_GrayLevelNonUniformityNormalized.NA", 
"pyrad_tum_wavelet.LHH_glszm_LargeAreaEmphasis.NA", "pyrad_tum_wavelet.LHH_glszm_LargeAreaLowGrayLevelEmphasis.NA", 
"pyrad_tum_wavelet.LHH_glszm_SizeZoneNonUniformityNormalized.NA"
), class = "data.frame")

Edit3 : So i figured out that my function p.adjust.method doesn't work here because when I change by "bonferroni" or "hochberg", it doesn't change anything and I think that at every iteration, it uses only one comparison to divise by (it explains the exact same numbers), but at this moment, why is the

pvalue.adj<-pvalue %>%  
  mutate(bonferroni = p.adjust(p_values, method="bonferroni"),
         hochberg = p.adjust(p_values, method="hochberg"))

not really working too ?

Individualy, i tested the features and...same problem...can someone has an explanation ?

wilcox.test(d$F1~d$LesionResponse,p.adjust.method = "none")

    Wilcoxon rank sum test with continuity correction

data:  d$F1 by d$LesionResponse
W = 93381, p-value = 0.005513
alternative hypothesis: true location shift is not equal to 0

wilcox.test(d$F1~d$LesionResponse,p.adjust.method = "hochberg")

    Wilcoxon rank sum test with continuity correction

data:  d$F1 by d$LesionResponse
W = 93381, p-value = 0.005513
alternative hypothesis: true location shift is not equal to 0

Edit 4 : So I try with rstatix and nothing change also...if someone can get me out of this terrible situation he's welcome^^ enter image description here

I found the problem... It was the Benjamini-Hochberg and not the Hochberg correction that I wanted to apply...

NDe
  • 71
  • 6
  • *"I remember that I had to use the tilde between the groups"* ... where is that stated? `g` can be a *"grouping vector or factor"* (from `?pairwise.wilcox.test`). If your first code block works, is there something indicating that the results are incorrect? If not, why change? – r2evans Feb 13 '23 at 15:05
  • I'm a medical student learning R in fact. I'm just a beginner and don't know all the tips, so I asked my boss to check my results after adjustement (there is no values below 0.05...) and he told me that. And indeed i chose pairwise.wilcox because of this... – NDe Feb 13 '23 at 15:14
  • @r2evans In fact, when I plot the values unadjusted, there is a great signal with a big majority of p values below 0.05. After Hochberg, who must be conservative, it changes a lot and all my values are near 1... – NDe Feb 13 '23 at 15:16
  • Perhaps you want `wilcox.test` and not `pairwise.wilcox.test`? You'll have to manually iterate over all of the combinations, but `wilcox.test` supports a formula interface. `pairwise...` [_does not_](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/pairwise.wilcox.test.html). – r2evans Feb 13 '23 at 15:28
  • there is no possibility to make a sort of loop with wilcox.test ? And I just read on another forum that the pairwise.wilcox.test adjusted automatically...When I add the `p.adjust.method = "hochberg"` in my formula, it doesn't change the results. Maybe since the beginning I am adjusting adjusted datas... – NDe Feb 13 '23 at 15:33
  • Most likely there is, but ... if your `lapply` code works, and you're getting p-values (adjusted with bonf/hoch or not) that make sense, what is wrong here? Is it just that you really want to include a `~` somewhere in your code? – r2evans Feb 13 '23 at 15:52
  • no ahah but I just don't understand 2 things : 1) Why is there no modification of the p-values whenever I add `p.adjust.method=none` in my `wilcox.test` or if I add a method like hoshberg/holm/etc... ? 2)If I change `pairwise.wilcox.test` with `wilcox.test` with a modification of the formula (~), there is no modification of the results (ok with this), but the fact is I don't adjuste the results.... – NDe Feb 13 '23 at 15:56
  • (1) I don't know. (2) If you call `p.adjust(pvalue, "bonf")` on all p-values from a set of tests, it adjusts them. I'm not familiar enough with either p-value adjustment though to know if that is legitimate, though. – r2evans Feb 13 '23 at 15:58
  • Yes I know but the results are very strange considering the fact that I don't precisely add the `p.adjust.method=none` before. I just edited the post to show you – NDe Feb 13 '23 at 16:14
  • Yes, have you tried not adjusting in `pairwise..`, instead calling `p.adjust(.)` manually on all collected pvalues? – r2evans Feb 13 '23 at 16:21
  • I think I understood the challenge. I will change my formula and explain in the main post – NDe Feb 13 '23 at 16:28
  • @r2evans that is what I wanted to do in my second part of my post with the ```pvalue.adj<-pvalue %>% mutate(bonferroni = p.adjust(p_values, method="bonferroni"), hochberg = p.adjust(p_values, method="hochberg"))``` – NDe Feb 13 '23 at 16:36
  • `stats::wilcox.test` has no `p.adjust.method` parameter. `rstatix::wilcox_test` does. Perhaps that why it has no effect in your code? Even if you are using `rstatix::wilcox_test`, the adjustment will probably have no effect because you are performing each of your 158-3+1 tests one-by-one, in a loop. I suspect that's why you need the post-hoc adjustment that others have given you. Also, with that many tests, adjustments will be huge, especially for the Bonferonni adjustment. Is your "boss" a medic or a statistician? Sometimes it pays to consult the appropriately qualified expert... – Limey Feb 13 '23 at 17:24
  • @Limey a medic...I will try with rstatix thanks ! – NDe Feb 13 '23 at 19:30
  • Problem solved, it was the Benjamini-Hochberg and not the Hochberg lmao. I'm so stupid – NDe Feb 14 '23 at 08:42

0 Answers0