我有一個這樣的資料集:
structure(list(status = c(0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0,
1, 0, 0, 1, 1, 0, 1, 0), feature1 = c(26.55, 37.21, 57.29, 90.82,
20.17, 89.84, 94.47, 66.08, 62.91, 6.18, 20.6, 17.66, 68.7, 38.41,
76.98, 49.77, 71.76, 99.19, 38, 77.74), feature2 = c(18.488,
70.237, 57.333, 16.805, 94.384, 94.347, 12.916, 83.345, 46.802,
54.998, 55.267, 23.889, 76.051, 18.082, 40.528, 85.355, 97.64,
22.583, 44.481, 7.498), feature3 = c(16.8, 80.75, 38.49, 32.77,
60.21, 60.44, 12.46, 29.46, 57.76, 63.1, 51.2, 50.5, 53.4, 55.72,
86.79, 82.97, 11.14, 70.37, 89.75, 27.97), feature4 = c(58.58,
0.8946, 29.374, 27.7375, 81.3574, 26.0428, 72.4406, 90.6092,
94.904, 7.3144, 75.4675, 28.6001, 10.0054, 95.4069, 41.5607,
45.5102, 97.1056, 58.3988, 96.2205, 76.1702), feature5 = c(20.02,
68.52, 91.69, 28.44, 10.47, 70.11, 52.8, 80.79, 95.65, 11.05,
27.33, 49.05, 31.84, 55.92, 26.26, 20.19, 38.75, 88.79, 55.49,
84.22), feature6 = c(60.62683, 93.7642, 26.43521, 38.00939, 80.74834,
97.80757, 95.79337, 76.27319, 50.96485, 6.44768, 64.35728, 91.59089,
9.52326, 29.53728, 76.99317, 25.58935, 51.78957, 67.78499, 14.72278,
70.0526), feature7 = c(98.89, 39.77, 11.57, 6.97, 24.37, 79.2,
34.01, 97.21, 16.59, 45.91, 17.17, 23.15, 77.28, 9.63, 45.34,
8.47, 56.07, 0.87, 98.57, 31.66), feature8 = c(46.63, 20.782,
79.966, 65.187, 32.151, 71.893, 29.087, 93.227, 76.915, 64.449,
45.704, 8.93, 43.239, 54.496, 13.822, 92.781, 0.13, 26.446, 27.653,
52.111), feature9 = c(22.16, 2.423, 20.712, 21.573, 44.372, 13.408,
39.066, 36.932, 66.869, 99.211, 11.764, 0.847, 88.337, 30.105,
49.274, 50.063, 40.203, 97.708, 35.833, 49.166), feature10 = c(50.75,
30.68, 42.69, 69.31, 8.51, 22.54, 27.45, 27.23, 61.58, 42.97,
65.17, 56.77, 11.35, 59.59, 35.8, 42.88, 5.19, 26.42, 39.88,
83.61), feature11 = c(27.725, 0.052, 51.061, 1.405, 6.469, 95.485,
8.65, 28.998, 88.07, 12.322, 17.511, 44.075, 90.718, 85.104,
73.399, 57.369, 48.177, 33.061, 15.766, 48.013), feature12 = c(6.936,
81.778, 94.262, 26.938, 16.935, 3.39, 17.879, 64.167, 2.288,
0.832, 39.27, 81.388, 37.625, 38.081, 26.492, 43.933, 45.761,
54.071, 66.568, 11.27), feature13 = c(71.03, 24.61, 38.96, 9.14,
96.21, 1.09, 57.43, 76.44, 87.34, 4.11, 66.11, 87.84, 89.06,
56.63, 59.35, 36.45, 35.74, 59.15, 86.55, 68.05), feature14 = c(25.4,
63.78, 95.72, 55.25, 98.31, 51.15, 93.28, 42.84, 48.56, 38.17,
89.1, 16.38, 47.41, 85.12, 85.75, 73.97, 35.31, 67.34, 85.16,
59.54), feature15 = c(60.211, 19.504, 96.646, 65.091, 36.707,
98.886, 81.519, 25.397, 68.723, 83.143, 10.467, 64.615, 50.909,
70.663, 86.231, 84.179, 44.744, 96.467, 14.119, 77.671), feature16 = c(68.311,
24.4117, 45.0111, 22.9435, 86.3508, 31.12, 7.4337, 83.2322, 87.448,
13.9362, 31.9745, 59.1115, 15.722, 66.1382, 52.5341, 24.0202,
84.7312, 68.8515, 71.6726, 7.6156), feature17 = c(15.505, 96.838,
46.826, 77.682, 40.789, 53.88, 20.689, 18.71, 77.997, 19.394,
43.423, 0.227, 83.469, 83.008, 95.697, 94.85, 60.073, 26.181,
64.303, 52.623), feature18 = c(82.29, 71.02, 96.583, 7.861, 5.364,
57.498, 38.778, 51.039, 36.615, 21.793, 64.288, 75.282, 9.225,
30.731, 99.208, 11.898, 52.544, 4.127, 93.889, 6.717), feature19 = c(11.71,
48.4, 65.12, 6.84, 36.53, 22.39, 29.19, 57.33, 83.66, 72.61,
40.65, 44.97, 79.1, 92.42, 22.82, 90.5, 39.75, 56.77, 42.74,
83.82), feature20 = c(87.75, 76.85, 27.9, 52.92, 96.29, 98.04,
9.13, 7.07, 32.76, 37.01, 71.55, 75.78, 0.19, 74.28, 19.24, 45.21,
32.21, 10.91, 28.93, 81.95), feature21 = c(78.611, 25.245, 69.925,
18.446, 95.961, 91.868, 10.18, 17.219, 98.6, 84.94, 66.754, 93.521,
5.818, 61.862, 17.492, 3.768, 52.531, 28.218, 49.905, 63.383),
feature22 = c(30.428, 47.474, 99.353, 52.065, 84.323, 72.331,
61.517, 73.917, 41.724, 37.262, 96.842, 60.741, 47.368, 85.814,
43.535, 8.227, 42.079, 17.491, 61.813, 37.156), feature23 = c(57.66,
22.307, 33.19, 71.072, 81.945, 42.372, 96.354, 97.813, 84.052,
99.661, 86.596, 70.142, 39.047, 31.477, 84.595, 13.928, 51.812,
59.355, 94.246, 62.802), feature24 = c(29.2574, 22.4891,
70.4223, 51.8897, 66.262, 92.0444, 27.9736, 76.382, 80.1631,
25.4725, 60.4889, 37.0735, 67.169, 67.2982, 32.0431, 90.415,
19.8116, 4.4203, 50.0922, 13.8783), feature25 = c(41.61,
69.48, 14.88, 89.74, 12.44, 98.51, 62.61, 33.75, 6.68, 28.21,
32.8, 36.35, 95.85, 58.89, 69.54, 14.75, 53.97, 72.82, 47.69,
72.94), feature26 = c(1.7, 28.9, 87.4, 80, 31.2, 47.1, 79.6,
73.5, 34.1, 66.9, 55.9, 23.2, 55.1, 0.9, 82, 31.2, 48.4,
39.2, 66.3, 74.1), feature27 = c(97.175, 8.376, 87.387, 32.923,
22.228, 40.165, 7.25, 0.245, 13.709, 19.191, 61.61, 84.962,
50.275, 73.832, 87.645, 78.63, 98.36, 9.069, 59.4, 4.607),
feature28 = c(2.86, 8.84, 47.44, 88.54, 9.16, 75.73, 3.44,
86.86, 56.46, 94.68, 70.24, 66.05, 61.62, 81.73, 50.82, 32.29,
37.78, 66.94, 96.72, 45.9), feature29 = c(9.97, 24.09, 10.32,
32.56, 58.5, 9.31, 82.82, 86.63, 12, 23.31, 98.26, 39.31,
30.1, 63.15, 17.62, 82.74, 66.25, 36.21, 86.67, 36.26), feature30 = c(9.88,
48.82, 36.4, 42.06, 30.1, 14.76, 89.86, 22.36, 96.6, 14.11,
6.54, 39.73, 54.4, 87.96, 22.34, 92.09, 25.15, 83.05, 60.82,
43.14), feature31 = c(52.22, 95, 42.69, 42.44, 94.47, 45.21,
83.27, 17.27, 93.4, 24.31, 32.83, 83.02, 65.19, 1.41, 82.1,
11.51, 10.12, 47.39, 23.24, 10.77), feature32 = c(50.58,
59.48, 80.87, 72.88, 15.2, 95.62, 75.35, 85.21, 67.34, 38.71,
65.8, 32.14, 61.21, 77.26, 26.62, 74.88, 79.94, 41.95, 62.22,
90.76), feature33 = c(44.594, 39.465, 48.373, 91.888, 84.388,
51.735, 43.713, 34.32, 1.552, 11.799, 69.099, 26.049, 22.505,
34.239, 78.189, 84.325, 77.475, 38.719, 13.577, 90.036),
feature34 = c(44.48, 99.85, 88.49, 23.84, 22.73, 84.78, 28.26,
71.76, 39.61, 57.47, 32.44, 43.94, 74.88, 4.68, 19.79, 81.18,
85.7, 1.56, 49.7, 49.32), feature35 = c(85.66, 1.08, 55.29,
95.02, 48.64, 9.39, 48.21, 59.79, 99.96, 97.1, 34.72, 55.13,
65.93, 34.54, 28.7, 65.37, 88.32, 81.18, 63.65, 46.42), feature36 = c(62.24,
67.55, 80.23, 26.03, 75.98, 1.99, 95.54, 43.67, 8.92, 36.05,
28.44, 61.04, 52.37, 5.17, 7.57, 41.41, 57.78, 11.03, 51.07,
16.91), feature37 = c(54.96, 7.88, 64.88, 49.69, 71.88, 83.95,
38.45, 35.21, 20.37, 14.73, 36.97, 72.57, 42.38, 0.22, 91.36,
80.02, 80.4, 14.09, 58.55, 81.5), feature38 = c(39.99, 2.03,
14.56, 37.75, 75.38, 75.18, 51, 44.16, 4.73, 86.74, 6.9,
50.8, 66.66, 39.68, 50.32, 31.1, 81.21, 7.8, 34.1, 77.75),
feature39 = c(42.64, 20.63, 10.95, 7.97, 33.46, 77.34, 27.56,
46.71, 67.99, 41.91, 66.34, 24.85, 15.35, 33.47, 26.68, 98.26,
79.87, 59.61, 83.19, 26.22), feature40 = c(68.358, 87.29,
69.012, 11.594, 19.501, 46.12, 20.354, 59.085, 37.389, 14.13,
9.616, 70.287, 7.759, 23.49, 95.95, 79.51, 38.657, 97.627,
9.529, 58.19), feature41 = c(21.35, 97.12, 57.82, 14.21,
84.18, 96.2, 90.13, 52.19, 81.75, 66.83, 68.92, 73.39, 72.55,
29.08, 5.71, 79.76, 84.15, 8.91, 98.57, 10.58), feature42 = c(91.48,
93.71, 28.61, 83.04, 64.17, 51.91, 73.66, 13.47, 65.7, 70.51,
45.77, 71.91, 93.47, 25.54, 46.23, 94, 97.82, 11.75, 47.5,
56.03), feature43 = c(48.504, 91.077, 5.767, 70.54, 31.35,
54.303, 67.91, 50.67, 18.297, 87.226, 39.072, 15.88, 65.041,
26.316, 47.592, 66.904, 24.63, 21.057, 2.832, 11.411), feature44 = c(74.34,
28.29, 50.76, 57.67, 3.22, 14.34, 44.72, 5.69, 11.53, 44.92,
9.18, 0.01, 82.03, 14.8, 43.53, 18.11, 5.46, 43.37, 20.18,
29.8), feature45 = c(63.337, 31.754, 24.092, 37.841, 35.214,
29.776, 22.782, 55.484, 18.456, 0.528, 36.889, 88.046, 30.805,
45.955, 43.072, 41.058, 96.478, 14.185, 40.901, 23.789),
feature46 = c(18.43, 24.34, 58.4, 34.56, 23.31, 65.51, 89.17,
59.34, 87.88, 94.85, 26.68, 10.3, 66.61, 6, 76.45, 65.94,
95.54, 13.49, 59.75, 54.21), feature47 = c(97.7, 37.39, 76.15,
82.25, 57.35, 69.14, 38.91, 46.89, 54.33, 92.49, 13.88, 70.2,
16.22, 59.93, 50.6, 90.2, 40.05, 3.09, 7.14, 46.83), feature48 = c(57.92,
3.38, 0.27, 37.73, 24.33, 11.89, 98.1, 3.83, 78.53, 46.36,
68.79, 33.92, 90.51, 51.44, 59.47, 90.79, 66.01, 80.29, 34.56,
50.74), feature49 = c(36.57, 48.79, 26.98, 60.68, 4.58, 29.66,
27, 10, 53.04, 82.49, 25.69, 43.95, 12.63, 66.59, 98.58,
1.69, 65.45, 20.6, 47.37, 45.93), feature50 = c(70.87, 43.77,
20, 76.71, 51.32, 4.47, 69.99, 64.63, 4.2, 10.75, 39.06,
26.98, 64.09, 7.76, 27.73, 67.61, 83.54, 36.46, 7.41, 16.89
), feature51 = c(77.6, 20.05, 29.83, 98.51, 21.64, 83.44,
75.14, 40.6, 97.1, 11.23, 50.75, 69.71, 17.1, 25.45, 1.81,
53.41, 13.28, 24.33, 63.76, 8.62), feature52 = c(16.2, 97,
34.65, 2.08, 90.47, 48.14, 83.02, 4.9, 1.65, 3.46, 85.75,
84.79, 9.55, 98.53, 70.79, 56.3, 15.55, 39.56, 78.23, 75.53
), feature53 = c(57.92, 11.68, 9.09, 61.2, 73.98, 65.73,
6.61, 33.46, 21.23, 65.69, 87.78, 4.18, 61.76, 51.37, 16.07,
78.06, 93.01, 42.99, 78.5, 52.3), feature54 = c(97.02, 66.75,
68.96, 19.48, 35.77, 65.68, 94.75, 68.55, 87.83, 90.8, 14.93,
96.5, 49.42, 51.38, 12.09, 5.72, 96.2, 4.99, 78.48, 4.79),
feature55 = c(54.78, 21.82, 3.5, 79.15, 56.02, 7.42, 13.15,
29.41, 50.08, 8.83, 88.27, 6.79, 30.67, 32.09, 46.05, 76.52,
62, 90.58, 57.86, 33.94), feature56 = c(40.48, 72.12, 30.84,
73.1, 34.63, 10.02, 21.32, 16.02, 70.54, 51.07, 93.17, 45.83,
68, 88.08, 60.28, 47.61, 75.27, 77.36, 49.71, 15.58), feature57 = c(24.39,
51.29, 3.86, 16.62, 73.32, 66.28, 97.81, 38.31, 55.6, 32.4,
94.8, 40.69, 91.77, 48.45, 19, 54.93, 15.18, 7.25, 82.93,
72.89), feature58 = c(32.65, 14.5, 66.63, 94.24, 83.69, 36.37,
24.03, 72.83, 26.8, 58.27, 3.2, 65.33, 39.21, 56.96, 69.02,
23.43, 97.04, 59.2, 80.28, 16.48), feature59 = c(3.13, 55.21,
87.28, 71.93, 62.46, 79.62, 91.92, 38.84, 98.74, 7.63, 28.44,
20.49, 28.13, 23.94, 12.52, 62.38, 78.72, 57.47, 65.67, 83.3
), feature60 = c(76.44, 35.28, 69.14, 69.59, 28.26, 9.55,
43.9, 88.86, 4.15, 80.34, 4.26, 25.96, 85.93, 34.43, 62.7,
69.54, 18.25, 45.24, 66.99, 30.73), feature61 = c(35.174,
94.248, 35.386, 1.627, 4.262, 15.784, 63.701, 7.571, 8.317,
28.701, 42.53, 26.373, 75.917, 48.779, 69.632, 39.617, 91.527,
11.837, 37.56, 39.109), feature62 = c(78.85, 34.6, 61.2,
71.59, 6.52, 13.09, 52.97, 29.34, 98.81, 69.02, 52.47, 97.27,
81.96, 46.69, 11.47, 85.18, 53.86, 68.15, 16.19, 0.99), feature63 = c(90.73,
19.98, 3.05, 7.82, 68.88, 73.85, 2.87, 20.95, 70.78, 7.71,
14.19, 2.29, 65.63, 80.06, 55.27, 48.68, 4.91, 94.29, 66.41,
58.37), feature64 = c(4.382, 82.721, 4.337, 98.933, 8.985,
81.769, 93.831, 62.017, 50.606, 58.651, 37.233, 6.775, 82.97,
63.34, 37.497, 15.865, 92.717, 95.039, 88.61, 96.764), feature65 = c(11.569,
68.803, 17.063, 4.268, 60.974, 26.707, 7.424, 52.279, 79.436,
86.585, 89.38, 17.866, 34.666, 93.631, 10.594, 33.723, 25.716,
20.979, 12.085, 53.058), feature66 = c(98.9937, 82.9693,
58.5887, 41.7046, 66.2097, 37.9302, 42.4266, 84.2513, 37.6442,
91.153, 25.8538, 20.3263, 22.4614, 91.4636, 89.0231, 27.9541,
42.9379, 27.4047, 51.2475, 35.5274), feature67 = c(88.87,
16.28, 45.05, 92.14, 16.92, 63.58, 46.84, 57.86, 12.64, 71.46,
14.52, 58.67, 35.03, 40.48, 72.85, 34.67, 95.28, 32.15, 6.21,
63.32), feature68 = c(92.45, 66.12, 40.24, 63.7, 35.26, 74.76,
71.75, 19.36, 33.31, 13.66, 50.33, 15.6, 87.5, 44.38, 65.99,
77.55, 81.24, 50.83, 79.75, 57.42), feature69 = c(53.08,
76.88, 64.59, 86.53, 36.89, 86.88, 17.11, 78.77, 17.36, 2.21,
88.29, 35.69, 92.56, 25.98, 18.3, 26.41, 12.16, 62.9, 5.81,
79.1), feature70 = c(6.16, 95.22, 63.57, 12.93, 86.42, 86.42,
30.9, 49.73, 17.4, 30.15, 44.74, 90.26, 60.87, 78.58, 34.28,
84.46, 4.49, 19.39, 65.34, 38.38), feature71 = c(33.293,
55.51, 32.737, 21.167, 31.612, 94.727, 66.171, 88.942, 33.801,
43.475, 11.758, 76.172, 14.18, 76.691, 84.214, 77.675, 13.383,
80.594, 89.678, 92.698), feature72 = c(91.47, 82.05, 87.7,
87.39, 51.37, 79.53, 84.97, 67.82, 73.77, 63.46, 62.52, 76.36,
58.57, 17.15, 90.49, 87.7, 27.62, 53.51, 29.4, 44.75), feature73 = c(44.23,
8.31, 61.46, 62.28, 53.74, 13.74, 44.93, 98.86, 19.85, 76.54,
55.61, 73.48, 93.79, 76.2, 99.69, 91.51, 93.96, 92.34, 67.78,
1.23), feature74 = c(70.462, 48, 19.602, 93.697, 86.983,
21.403, 2.409, 85.48, 70.272, 95.798, 81.564, 61.875, 94.078,
77.55, 5.003, 61.73, 19.818, 24.251, 6.087, 20.002), feature75 = c(21.386,
1.819, 68.397, 35.578, 7.581, 13.657, 54.997, 81.1, 94.471,
22.582, 77.819, 50.911, 65.479, 74.955, 75.418, 5.131, 9.665,
68.103, 62.377, 67.678), feature76 = c(62.459, 73.634, 43.134,
10.198, 46.756, 76.284, 30.101, 72.239, 32.164, 62.664, 55.695,
88.79, 94.345, 86.101, 30.874, 56.774, 32.638, 27.265, 50.521,
82.475), feature77 = c(29.13, 71.75, 86.24, 95.01, 73.88,
45.75, 85.14, 84.65, 56.74, 45.69, 87.24, 98.82, 16.59, 0.47,
44.76, 36.47, 55.81, 70.34, 92.52, 0.87), feature78 = c(76.34,
83.52, 60.19, 74.73, 85.88, 40.05, 29.54, 35.09, 9.23, 40.99,
88.13, 58.94, 36.27, 66.11, 28.82, 72.86, 22.57, 61.69, 3.99,
31.92), feature79 = c(86.593, 44.822, 70.511, 70.348, 59.848,
39.821, 20.149, 63.481, 86.104, 70.345, 0.428, 8.663, 12.466,
96.503, 15.564, 55.623, 16.005, 59.919, 53.661, 81.91), feature80 = c(43.96,
55.92, 78.56, 7.39, 60.45, 0.74, 67.34, 63.16, 59.23, 74.56,
35.86, 20.32, 50.4, 83.93, 41.23, 19.19, 31.44, 15.32, 52.86,
92.52), feature81 = c(15.03, 90.97, 68.73, 1.01, 80.6, 71.08,
71.48, 63.49, 61.84, 49.23, 44.35, 9.07, 19.85, 54.55, 41.18,
9.89, 8.19, 13.5, 36.4, 11.17), feature82 = c(11.1321, 8.3746,
61.9174, 44.6819, 37.052, 77.3647, 8.0281, 21.2781, 58.7536,
22.7211, 33.0055, 1.4459, 48.4983, 69.7259, 17.0981, 14.3781,
25.4319, 29.099, 99.6304, 0.6583), feature83 = c(0.88, 22.89,
52.52, 94.35, 47.74, 48.41, 57.7, 43.01, 87.11, 82, 16.57,
3.03, 96.68, 92.99, 34.27, 7.06, 71.97, 52.76, 75.04, 80.68
), feature84 = c(76.4115, 34.598, 87.2975, 76.7902, 22.7913,
26.7319, 12.5811, 32.0481, 60.0896, 14.6587, 73.4975, 99.9575,
87.0791, 91.274, 2.9249, 21.0416, 9.2114, 37.04, 8.3467,
45.1888), feature85 = c(49.43, 9.4, 28.65, 61.56, 57.45,
81.39, 17.57, 0.22, 14.66, 90.34, 1.98, 88.3, 4.39, 96.64,
43.09, 7.96, 86.2, 98.43, 1.69, 91.96), feature86 = c(76.077,
49.067, 90.235, 21.919, 46.453, 88.029, 33.376, 21.616, 73.707,
40.974, 22.073, 28.377, 57.266, 74.203, 33.54, 71.557, 61.007,
49.056, 83.546, 19.847), feature87 = c(1.61, 29.14, 4.25,
85.77, 3.06, 6.95, 18.01, 32.09, 96.68, 40.44, 45.84, 85.35,
18.15, 76.29, 24.96, 47.76, 84.35, 68.53, 29.12, 23.14),
feature88 = c(41.05, 10.27, 74.1, 48.01, 99.05, 99.95, 3.25,
76.02, 67.71, 97.68, 54.93, 74.42, 55.3, 18.1, 2.06, 33.06,
10.25, 59.29, 74.78, 76.28), feature89 = c(7.33, 90.95, 76.06,
82.27, 94.44, 73.66, 20.11, 1.66, 97.32, 26.21, 10.91, 51.56,
72.5, 46.4, 1.14, 85.54, 24.05, 11.1, 10.34, 67.6), feature90 = c(53.076,
88.507, 43.996, 94.229, 18.833, 65.553, 23.558, 38.634, 77.058,
47.78, 67.097, 1.725, 84.267, 56.327, 81.975, 31.377, 28.556,
49.231, 99.165, 25.616), feature91 = c(51.777, 41.82, 50.859,
65.633, 96.74, 42.07, 99.326, 35.319, 18.219, 66.611, 97.898,
3.879, 58.617, 39.951, 37.59, 98.76, 25.39, 69.328, 48.38,
47.361), feature92 = c(6.96, 64.358, 30.942, 64.467, 82.39,
83.392, 11.737, 47.91, 4.047, 18.796, 16.315, 57.25, 92.195,
81.872, 46.367, 38.273, 13.997, 20.488, 39.599, 87.521),
feature93 = c(37.38, 31.9, 25.2, 38.71, 76.45, 4.46, 82.43,
5.5, 79.96, 29.96, 12.3, 82.56, 99.67, 93.29, 83.95, 34.29,
81.27, 38.88, 81.6, 8.2), feature94 = c(87.52, 53.81, 63.54,
61.91, 6.61, 50.97, 89.52, 98.42, 11.04, 58.36, 44.56, 31.87,
34.41, 3.48, 78.76, 9.78, 88.21, 39.77, 0.52, 17.41), feature95 = c(15.171,
57.584, 5.31, 7.044, 48.888, 15.277, 37.406, 30.006, 96.997,
30.373, 75.704, 66.61, 19.355, 44.956, 14.121, 70.713, 83.999,
66.549, 40.903, 7.43), feature96 = c(52.781, 96.875, 92.053,
10.032, 96.775, 21.113, 91.297, 78.021, 44.392, 36.631, 8.119,
12.063, 97.484, 59.671, 60.837, 68.308, 58.559, 77.111, 49.712,
75.36), feature97 = c(4.113, 56.873, 98.058, 17.523, 83.594,
86.386, 96.583, 81.796, 29.536, 14.735, 49.08, 33.498, 54.154,
31.97, 14.861, 33.095, 57.756, 39.089, 27.392, 5.017), feature98 = c(46.713,
34.426, 33.162, 47.504, 24.766, 31.063, 2.875, 40.256, 71.992,
22.2, 85.934, 77.418, 23.695, 44.463, 37.19, 89.376, 28.426,
26.929, 71.987, 20.238), feature99 = c(58.47, 11.38, 68.43,
99.25, 53.5, 96.66, 67.14, 29.46, 35.84, 17.53, 54.88, 50.55,
19.38, 63.69, 68.78, 64.02, 35.79, 10.26, 9.78, 18.29), feature100 = c(30.78,
25.77, 55.23, 5.64, 46.85, 48.38, 81.24, 37.03, 54.66, 17.03,
62.5, 88.22, 28.04, 39.85, 76.26, 66.9, 20.46, 35.75, 35.95,
69.03)), row.names = c(NA, -20L), class = "data.frame")
現在我需要運行 glm 模型并檢索具有結果的每個變數的 p 值 < 0.05:狀態。我正在嘗試使用回圈來實作它,但我無法寫出正確的。
我的想法是首先,我創建一個串列來保存 glm 模型代碼的所有結果,然后,使用另一個串列來存盤“摘要”中的所有 p<-value,然后使用過濾器過濾掉 >0.05 的記錄。
for (i in colnames(df2)){
list_glm<-list()
z<-list()
list_glm<-glm(status~i, data =df2, family = binomial())
z<-summary(list_glm)$coefficients[,4]
}
有人可以幫忙弄清楚嗎?非常感謝~~!
uj5u.com熱心網友回復:
我會從寬到長,嵌套資料,然后同時運行回歸。然后,您可以繪制模型的 p 值并過濾掉 p < 0.05 的特征。看起來有 4 個模型符合您的示例資料的標準。
library(tidyverse)
df |>
pivot_longer(cols = -status) |>
nest(data = -name) |>
mutate(mod = map(data, ~glm(status~value, data = .x, family = binomial())),
p.value = map_dbl(mod, ~summary(.x)$coefficients[2,4])) |>
select(name, p.value) |>
filter(p.value < 0.05)
#> # A tibble: 4 x 2
#> name p.value
#> <chr> <dbl>
#> 1 feature10 0.0370
#> 2 feature34 0.0243
#> 3 feature41 0.0189
#> 4 feature86 0.0498
uj5u.com熱心網友回復:
list_glm<-list()
z<-list()
for (i in colnames(df2)[2:length(colnames(df2)]){
formula <- paste0("status ~", i)
list_glm[[i]] <- glm(formula = formula, data =df2, family = binomial())
z[[i]] <-summary( list_glm[[i]])$coefficients[,4]
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/515269.html
標籤:r
上一篇:向ggplot添加其他方面