Метка значимости между двумя точками на графике рассеяния в R - PullRequest
1 голос
/ 24 марта 2020

Мои данные:

structure(list(Point = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 
36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 
49L, 50L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 
13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 
26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 
39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L), 
    DF_FA_L = c(0.723876631, 0.736984528, 0.715005484, 0.689702567, 
    0.652340718, 0.602542524, 0.558524996, 0.515559258, 0.476045448, 
    0.440791984, 0.435388397, 0.433995996, 0.450236063, 0.461067635, 
    0.450821663, 0.406453595, 0.36881377, 0.368414258, 0.399242306, 
    0.434842762, 0.448778794, 0.450645853, 0.473092464, 0.502696464, 
    0.507365944, 0.498556214, 0.482145956, 0.458311758, 0.423308377, 
    0.385789401, 0.362710119, 0.351632877, 0.336368766, 0.327589544, 
    0.322429925, 0.319228948, 0.324069718, 0.335910091, 0.344128766, 
    0.361908972, 0.377642905, 0.382828373, 0.38802394, 0.385629004, 
    0.376905508, 0.365854595, 0.354565575, 0.346827766, 0.340045925, 
    0.344910972, 0.714518667, 0.728961368, 0.701283807, 0.663229965, 
    0.613014667, 0.547104, 0.504106246, 0.487034053, 0.451825246, 
    0.442370175, 0.438668316, 0.450059526, 0.478947649, 0.481134439, 
    0.446763544, 0.396206754, 0.357049368, 0.343943632, 0.376060404, 
    0.413613877, 0.434964895, 0.451208632, 0.470569193, 0.515300737, 
    0.543379719, 0.550050702, 0.541725807, 0.517293316, 0.485205246, 
    0.438844404, 0.395223491, 0.374209193, 0.354036316, 0.340668123, 
    0.326388667, 0.328114842, 0.342721667, 0.357620474, 0.372856842, 
    0.377362316, 0.393890737, 0.419330684, 0.419797667, 0.423127684, 
    0.421407509, 0.403711632, 0.39075314, 0.373226596, 0.348689877, 
    0.329466947), DF_FA_R = c(0.279912032, 0.306765439, 0.327785755, 
    0.355029826, 0.393800091, 0.44807915, 0.500145704, 0.52518085, 
    0.513479676, 0.498788964, 0.471167874, 0.444077727, 0.405423269, 
    0.374111696, 0.336296723, 0.290903704, 0.245428277, 0.207306561, 
    0.192131277, 0.193623134, 0.218199818, 0.242609257, 0.275690593, 
    0.305088802, 0.340290617, 0.380668937, 0.407181352, 0.427695356, 
    0.452447949, 0.449012126, 0.426914032, 0.400893245, 0.365861043, 
    0.345163874, 0.324515277, 0.305764024, 0.298522166, 0.298830834, 
    0.301616281, 0.304933115, 0.303430024, 0.307914826, 0.329325708, 
    0.349910727, 0.35703696, 0.352538779, 0.345419684, 0.338729395, 
    0.331719186, 0.334689565, 0.293618667, 0.30652786, 0.323910193, 
    0.334828491, 0.37942207, 0.428091754, 0.455930368, 0.478020105, 
    0.484362053, 0.501357439, 0.482654246, 0.490658667, 0.488896421, 
    0.471009596, 0.451751193, 0.443464982, 0.423077596, 0.405938053, 
    0.371860298, 0.342142386, 0.355380404, 0.336650965, 0.306194123, 
    0.307005667, 0.331578158, 0.393752421, 0.428736263, 0.434643421, 
    0.471135439, 0.485811825, 0.490740421, 0.464038193, 0.436188053, 
    0.381632737, 0.330827035, 0.302487754, 0.289443614, 0.295707035, 
    0.310712982, 0.320383877, 0.316538596, 0.333027772, 0.349954807, 
    0.368749877, 0.370285947, 0.369342158, 0.364773474, 0.368712281, 
    0.354579614, 0.355067965), DF_RD_L = c(0.00128287, 0.001346415, 
    0.001389324, 0.00139913, 0.001387198, 0.001263581, 0.001176972, 
    0.001140379, 0.001122925, 0.001084178, 0.001079348, 0.00108896, 
    0.001085937, 0.001103557, 0.001123668, 0.00108613, 0.00107296, 
    0.001127423, 0.001197549, 0.001237273, 0.001338632, 0.00140204, 
    0.001453071, 0.001519708, 0.001549107, 0.00155198, 0.00150604, 
    0.001412095, 0.001324316, 0.001200802, 0.001097542, 0.001016119, 
    0.000963012, 0.000931372, 0.000900976, 0.000881988, 0.000850344, 
    0.000821751, 0.000819154, 0.000832779, 0.000848632, 0.000855727, 
    0.000886138, 0.000928174, 0.000967573, 0.000993269, 0.00102087, 
    0.001044502, 0.001108162, 0.001147996, 0.001030544, 0.001002509, 
    0.000955719, 0.000960175, 0.000929596, 0.000859965, 0.000856088, 
    0.000872825, 0.000891491, 0.000911193, 0.000971596, 0.000966702, 
    0.000929737, 0.000848895, 0.00084314, 0.00090893, 0.000922965, 
    0.000901526, 0.000897684, 0.000943158, 0.001035895, 0.001122333, 
    0.001116579, 0.001220842, 0.001180579, 0.001107, 0.000939316, 
    0.000837246, 0.000755596, 0.000709491, 0.000701351, 0.00068907, 
    0.000685053, 0.000695982, 0.000714667, 0.000748246, 0.000763649, 
    0.000784035, 0.000780456, 0.000785526, 0.000883333, 0.000923246, 
    0.000973, 0.000999053, 0.000966965, 0.000956228, 0.000990807, 
    0.001019947, 0.001032, 0.001015088), DF_RD_R = c(0.001482767, 
    0.001472708, 0.001472478, 0.00144036, 0.001390383, 0.001321597, 
    0.001184138, 0.001090482, 0.001036292, 0.000992798, 0.00100483, 
    0.001011154, 0.001038285, 0.001050253, 0.001042162, 0.001114103, 
    0.001193858, 0.001285597, 0.001391779, 0.001459791, 0.001526862, 
    0.001556233, 0.0015487, 0.001586964, 0.001553826, 0.001558518, 
    0.001608079, 0.001625, 0.001649866, 0.001597375, 0.001556644, 
    0.001644312, 0.001805107, 0.001960146, 0.002029423, 0.002055767, 
    0.002054854, 0.002002909, 0.001907099, 0.001820692, 0.001730158, 
    0.001669328, 0.001597581, 0.001507957, 0.001395277, 0.001349368, 
    0.001355585, 0.001372605, 0.001353186, 0.001293146, 0.001227825, 
    0.001200614, 0.001173175, 0.001147842, 0.001152842, 0.001008702, 
    0.00098614, 0.001007509, 0.000980421, 0.000940018, 0.000966193, 
    0.00101586, 0.000984737, 0.000933228, 0.000892789, 0.000954667, 
    0.001052895, 0.001099088, 0.001107298, 0.001228842, 0.001332491, 
    0.001425088, 0.001486649, 0.001470333, 0.001509263, 0.001441, 
    0.001411895, 0.001404947, 0.001355175, 0.001309789, 0.001320947, 
    0.001307368, 0.001367386, 0.001385386, 0.001371596, 0.001356842, 
    0.001350632, 0.001298965, 0.001209105, 0.001162, 0.001164649, 
    0.001150386, 0.001157684, 0.001149298, 0.001122561, 0.00106893, 
    0.001050825, 0.001104351, 0.001050544, 0.001091544), AgeGroup = c("Old", 
    "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", 
    "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", 
    "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", 
    "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", 
    "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", "Old", 
    "Old", "Old", "Old", "Old", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young", "Young", "Young", "Young", 
    "Young", "Young", "Young", "Young")), class = "data.frame", row.names = c(NA, 
-100L))

Построение некоторых интересующих данных:

Myplot <- ggplot(DF, aes(x = Point, y = DF_FA_L, color = AgeGroup)) + 
  geom_point(aes(shape=AgeGroup))

Что выглядит так:

enter image description here

Мой интерес заключается в том, чтобы * печатать * по каждому значению соответствующим образом, чтобы визуализировать, какие две точки значительно отличаются друг от друга.

В настоящее время, чтобы получить значимые значения между каждой точкой, я запускаю t-тест с набором необработанных данных, а затем нанесите значения p на той же оси X.

ОБРАЗЕЦ набора необработанных данных

structure(list(ID = c(5356L, 5357L, 5358L, 5359L, 5360L, 5363L
), sex = c(1L, 1L, 2L, 1L, NA, 1L), AgeGroup = c("Old", "Old", 
"Old", "Old", "Old", "Old"), P1 = c(0.846218, 0.818277, 0.394048, 
0.817749, 0.459284, 0.818235), P2 = c(0.749018, 0.762768, 0.641596, 
0.778927, 0.742783, 0.78261), P3 = c(0.85127, 0.778184, 0.755854, 
0.75728, 0.661668, 0.797338), P4 = c(0.844308, 0.779024, 0.689351, 
0.650052, 0.783829, 0.730145), P5 = c(0.787763, 0.697728, 0.668848, 
0.730858, 0.692566, 0.708917), P6 = c(0.532558, 0.639361, 0.701394, 
0.658054, 0.655189, 0.653637), P7 = c(0.538886, 0.563347, 0.563391, 
0.582696, 0.579147, 0.589373), P8 = c(0.612433, 0.525205, 0.52012, 
0.495403, 0.479324, 0.379151), P9 = c(0.610298, 0.458874, 0.512224, 
0.364992, 0.446096, 0.415491), P10 = c(0.610437, 0.443188, 0.508442, 
0.326629, 0.368318, 0.400495), P11 = c(0.582697, 0.436657, 0.367942, 
0.419647, 0.509359, 0.359965), P12 = c(0.418116, 0.406218, 0.432974, 
0.536345, 0.384733, 0.413433), P13 = c(0.335965, 0.367993, 0.477519, 
0.560785, 0.45537, 0.48867), P14 = c(0.337992, 0.486724, 0.54703, 
0.58446, 0.483832, 0.597846), P15 = c(0.515328, 0.496987, 0.487978, 
0.424243, 0.346461, 0.628548), P16 = c(0.290485, 0.296858, 0.546061, 
0.407782, 0.363341, 0.440781), P17 = c(0.345598, 0.339083, 0.389276, 
0.367848, 0.456301, 0.494254), P18 = c(0.555913, 0.338544, 0.289163, 
0.423237, 0.35898, 0.273942), P19 = c(0.458874, 0.448812, 0.383933, 
0.534538, 0.428785, 0.372345), P20 = c(0.467797, 0.449758, 0.417042, 
0.526268, 0.517699, 0.542448), P21 = c(0.484283, 0.341703, 0.489561, 
0.488149, 0.492702, 0.574437), P22 = c(0.52395, 0.461447, 0.393448, 
0.478467, 0.462262, 0.684624), P23 = c(0.483296, 0.532121, 0.362841, 
0.571371, 0.501969, 0.589329), P24 = c(0.401993, 0.289979, 0.507893, 
0.54272, 0.582495, 0.569918), P25 = c(0.321685, 0.365791, 0.627645, 
0.551962, 0.49566, 0.666437), P26 = c(0.269855, 0.316144, 0.530101, 
0.531981, 0.485203, 0.523233), P27 = c(0.230605, 0.330686, 0.53342, 
0.523332, 0.416405, 0.497638), P28 = c(0.330101, 0.394783, 0.490131, 
0.42861, 0.365622, 0.488487), P29 = c(0.337178, 0.352451, 0.444646, 
0.459683, 0.322466, 0.430228), P30 = c(0.258203, 0.448741, 0.256495, 
0.431901, 0.294633, 0.358938), P31 = c(0.251116, 0.320609, 0.229432, 
0.38704, 0.352998, 0.307074), P32 = c(0.232901, 0.328501, 0.324575, 
0.347392, 0.320678, 0.348555), P33 = c(0.253213, 0.297051, 0.229997, 
0.25181, 0.280018, 0.401357), P34 = c(0.213982, 0.294554, 0.231242, 
0.307669, 0.306246, 0.326005), P35 = c(0.224542, 0.351411, 0.232466, 
0.287418, 0.328158, 0.292336), P36 = c(0.296813, 0.360996, 0.216996, 
0.257623, 0.34479, 0.337268), P37 = c(0.374465, 0.404577, 0.234981, 
0.289122, 0.297555, 0.329936), P38 = c(0.368419, 0.493077, 0.341728, 
0.319635, 0.310216, 0.31797), P39 = c(0.344618, 0.422014, 0.344069, 
0.393116, 0.317624, 0.315584), P40 = c(0.354358, 0.374753, 0.329991, 
0.394953, 0.320049, 0.318013), P41 = c(0.403487, 0.295078, 0.517829, 
0.468743, 0.394567, 0.330027), P42 = c(0.381721, 0.278112, 0.401598, 
0.394999, 0.402283, 0.313942), P43 = c(0.298645, 0.242265, 0.431335, 
0.472077, 0.387318, 0.308056), P44 = c(0.250141, 0.241611, 0.486916, 
0.402863, 0.371897, 0.357648), P45 = c(0.34065, 0.260425, 0.412001, 
0.365537, 0.317708, 0.284206), P46 = c(0.223116, 0.252645, 0.339408, 
0.489459, 0.302774, 0.283245), P47 = c(0.208375, 0.309779, 0.312521, 
0.448492, 0.303502, 0.303485), P48 = c(0.189177, 0.367197, 0.296298, 
0.372935, 0.34973, 0.306106), P49 = c(0.127422, 0.277153, 0.243066, 
0.356067, 0.360099, 0.216733), P50 = c(0.164432, 0.391867, 0.249639, 
0.364488, 0.347897, 0.312913)), row.names = c(NA, 6L), class = "data.frame")

T-тест:

rawDF_tTest = lapply(rawDF_tTest [c(-1,-2,-3)], function(x) t.test(x ~ AgeGroup, data = rawDF_tTest , rate = 0.1, var.equal = T))
rawDF_tTest = data.frame(do.call(rbind, rawDF_tTest ))

Затем построить график:

# color pallete
 myPalette <- colorRampPalette(c("firebrick","orange","yellow1","turquoise4"))

ggplot(rawDF_tTest , aes(x = 1:50, y =log10(as.numeric(rawDF_tTest $p.value)))) + 
  geom_line(aes(color = as.numeric(rawDF_tTest $p.value)), size = 3) +
  scale_colour_gradientn(colours = myPalette(100), limits=c(-0.01, 1))

Что получается: enter image description here

Я хотел бы знать, могу ли я использовать значения t-критерия, чтобы просто построить все на одном графике?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...