我正在使用leaps
包生成以下图表:
> library(leaps)
>
>
> dput(datSel)
structure(list(oenb_dependent = c(1.0227039, -5.0683144, 0.6657713,
3.3161374, -2.1586704, -0.7833623, -0.2203209, 2.416144, -1.7625406,
-0.1565037, -7.9803936, 9.4594715, -4.8104584, 8.4827107, -6.1895262,
1.4288595, 1.4896459, -0.4198522, -5.1583964, 5.2502294, 1.0567102,
-1.0923342, -1.5852298, 0.6061936, -0.3752335, 2.5008664, -1.3999729,
2.2802166, -2.1468756, -1.4890328, -0.79254376, 3.21804705, -0.94407886,
-0.27802316, -0.20753079, -1.12610048, 2.0883735, -0.7424854,
0.44203729, -1.48905938, 1.39644424, -3.8917377, 11.25665848,
-9.22884035, 3.26856762, -0.00179541, -2.39664325, 4.00455574,
-5.60891295, 4.6556348, -4.40536951, 6.64234497, -7.34787319,
7.56303006, -8.23083674, 4.43247855, 1.31090412), gdp = c(-271.6,
-284.2, 34.3, -206, -253.1, -116.8, -169.9, -63.6, -174.2, -138.2,
-171.2, -198.2, -126.2, -222.5, -8.2, -172.5, -169.1, -207.5,
-114.6, -182.4, -43.7, 43.5, 166, 293.1, -30, -144.6, 16.9, -115.6,
-147.4, -189.1, -166.8, -157.9, -108.7, -150.9, -267.3, -176.2,
-231.3, -160.4, -251.5, -194.5, -186.3, -193, -171.6, -191.7,
-254.4, -140.6, -126.3, -66.7, -102.3, -100.4, -133.1, -61.8,
-1.1, -130.3, -35.8, -114.9, -79.1), employ = c(0.2237, -0.024,
0.0906, 0.2809, 0.0555, -0.2404, 0.1717, -0.1225, 0.0538, -0.1211,
-0.2819, 0.2998, -0.2625, -0.0808, 0.2338, -0.3807, -0.2774,
-0.0124, -0.2158, -0.1496, 0.0765, 0.2548, 0.2935, -0.129, 0.3021,
-0.2781, -0.4863, -0.0464, -0.5377, -0.0671, -0.5776, -0.1231,
-0.4383, -0.4593, -0.3337, -0.0388, -0.4048, -0.0609, -0.4173,
-0.1218, -0.1554, -0.1477, 2.4688, 0.1383, 0.1927, -0.1106, -0.1791,
-0.154, 0.1666, -0.0767, -0.3145, -0.1784, 0.2428, -0.0614, 0.0611,
-0.0804, 0.1366), atx = c(296.910157, 22.96997, 22.719932, -18.090049,
-304.469971, 128.03003, 49.19999, -311.47001, -114.390014, 183.710083,
-267.380059, 56.169976, 818.880004, 115.449952, 65.060068, -405.610117,
-262.829834, 355.199951, -138.44, 141.720029, -538.630127, -402.029907,
54.210005, 1016.93001, 1175.389892, -177.23999, 747.070088, 14.319805,
341.959961, -223.759766, -182.03, -595.19998, -122.550049, 394.110107,
-472.800078, -209.580049, -407.540039, -417.01001, -201.519902,
-388.510005, -53.469971, -122.640014, -321.61001, -193.259985,
-46.180054, -142.599976, -13.059985, -79.840039, 172.859985,
46.090054, -148.8, -56.290054, 122.75, -20.279907, -113.240039,
87.860034, -31.580078), un.employ = c(-0.0946, 0.0285, -0.1297,
-0.0563, -0.2938, 0.2474, -0.386, 0.1812, -0.2538, -0.4493, 0.4135,
-0.7771, 0.4232, 0.2375, -0.2525, 0.3409, 0.1633, -0.0739, 0.4948,
0.3698, -0.4075, -0.7342, -0.2505, -0.3096, -0.3006, 0.3804,
0.3246, 0.4871, 0.1521, -0.3552, 0.22, 0.0585, 0.2905, 0.1454,
0.2726, 0.0472, -0.0215, -0.6432, 0.4422, 0.0229, -0.0864, -0.35,
-0.7569, -0.2062, 0.0867, -0.1833, -0.2003, -0.0546, -0.1151,
0.3641, -0.3421, -0.1825, -0.023, -0.2115, -0.0344, 0.0293, -0.0332
), carReg = c(0.73435946, 0.24001161, 16.90532537, -14.60281976,
6.47603166, -8.35815849, 3.55576685, 7.10705794, -4.6955223,
10.9623709, 5.5801857, -6.4499936, -9.46196502, 9.36289122, -8.52630424,
5.45070994, -4.5346405, -2.26716538, 2.56870398, 0.013737, 5.7750101,
-27.1060826, 1.08977179, 4.94934712, 17.55391859, -13.91160577,
10.38981128, -11.81349246, -0.0831467, 2.79748237, 1.84865463,
-1.98736934, -6.24191695, 13.33602659, -3.86527871, 0.78720993,
4.73360651, -4.1674034, 9.37426802, -5.90660464, -0.4915792,
-5.84811629, 9.67648643, -6.96872719, -7.6535767, 0.24847595,
0.18685263, -2.28766949, 1.1544631, -3.87636933, -2.4731545,
4.33876671, 1.08836339, 5.64525271, 1.90743854, -3.94709355,
-0.84611324), cpi = c(1.16, -3.26, 0.22, -3.51, 0.84, -2.81,
-0.34, -4.57, -0.12, -3.95, -1.37, -2.73, 0.35, -5.38, -4.43,
-3.08, 0.74, -3.03, -1.09, -2, 0.35, -1.52, 1.28, 0.2, -0.25,
-4.55, -2.49, -4.24, -0.31, -2.96, -2.24, -0.46, -0.06, -2.67,
-1.27, -1.4, -0.7, -0.96, -2.18, -2.53, -0.52, -1.74, -2.18,
-1.4, -0.34, -0.09, -1.65, -1.15, -0.17, -2.01, -1.38, -1.24,
0.09, -2.44, -1.92, -2.61, -0.34), prodPrice = c(0.3, 0.8, 1.4,
0.5, 0, 2.3, 1, -0.1, 0.1, -0.4, -1.1, -0.4, -0.1, -3.9, -4.5,
-1.74, -3.48, -5.84, -1.92, 0.19, -1.1, 3.56, 3.57, 2.28, -4.11,
-3.01, -3.67, -1.74, -1.63, -2.02, -2.74, -0.73, -1.74, -3.19,
-1.56, -0.64, 1.36, 0.55, -5.38, -2.11, -3.37, -2.02, -1.74,
-0.01, 1.02, 1.73, -1.82, 0.36, 0.18, -0.64, 1.29, 2.1, 0.82,
-0.09, 1.83, -1.83, -2.83), productionConstr = c(0.7000584, 3.900325,
0.4000333, 1.0000834, -4.6003834, -6.50054172, 7.00058342, 3.2002667,
-4.6003834, 1.1000917, 1.3001083, -5.5004584, 2.3001917, -2.2001833,
-3.60030006, 2.70022502, 3.20026664, -2.0001666, 2.340195, 0.8700725,
0.8700725, 0.2900242, -1.740145, 0.6800566, -1.4501208, 9.8508209,
-6.5705476, -1.2501041, 2.8002333, 1.2501042, -1.3501125, -1.0600884,
-4.9304108, -3.28027339, 4.15034589, -4.34036172, 0.87007251,
-9.85082091, 3.81031753, 2.70022502, -3.96033003, -3.86032169,
2.12017668, -1.93016085, -0.3900325, 3.58029836, -12.66105509,
2.03016918, -0.3900325, -2.22018502, -0.0900075, 0.87007251,
-0.78006501, -0.67005584, 7.44062006, -6.48054005, -1.25010417
), constrPriceIndex = c(-0.3, -0.3, -1.42e-14, 0.2, 0.5, -0.7,
0.3, -0.1, 0.3, -0.9, -0.1, 0.8, -0.2, -0.2, -0.3, 0.2, -0.1,
-0.1, -0.16686, 0.41673, -0.08334, 0.16669, 0.25004, -0.33339,
-0.41673, -0.50009, 0.25004, 0.83348, -0.08335, -0.08334, -0.3334,
0.33339, 1e-05, 0.08334, -0.08335, 0.41674, 0.16669, -0.16669,
-0.13514, 0.15617, 1e-05, -0.46855, 0.15619, 0.54662, 0, -0.23426,
0.07808, 0.07809, 0.15618, -0.31236, 0.0781, 0.31235, -0.15618,
-0.23427, 0.07809, 1e-05, -0.0781), constrCostTotal = c(-0.5,
-0.7, -0.1, -0.06667, -0.16667, -0.6, -0.83333, -0.2, -0.33333,
-1, -1.06667, 0.16667, -0.36667, -0.23333, -1.18893, -0.30742,
-0.05589, -1.92836, -1.0061, -0.25153, -0.67073, -0.02795, 0.0559,
1.62094, -1.62094, -2.51526, -2.06809, 0.02795, -0.16769, -1.45325,
-1.14584, -0.41921, -1.64889, -1.87246, -1.03405, -0.67073, 0.11179,
-0.13974, -0.36695, -0.61157, -0.51373, -1.73687, -1.49225, -0.44033,
-0.48926, -0.88067, -0.6605, -0.04893, -0.12231, -0.83175, -0.34248,
0.1957, -0.12231, -0.78282, -0.29355, -0.44034, -0.39141), primConstTot = c(-0.33334,
-0.93333, -0.16667, -0.33333, -0.16667, -0.86666, -0.3, -0.4,
-0.26667, -1.56667, -0.73333, 0.1, -0.23333, -0.26667, -1.5774,
-0.19284, 0.38568, -2.42423, -0.93663, 0.08265, -0.63361, 0.0551,
-0.49587, 2.39668, -1.70798, -3.36085, -2.56196, 0.16529, 0,
-1.84572, -1.3774, -0.49586, -1.70798, -1.90081, -0.55096, -0.77134,
-0.16529, -0.30303, -0.17066, -0.23853, -0.64401, -1.52657, -1.57426,
-0.28623, -0.54861, -1.07336, -0.71558, 0.02385, -0.38164, -1.09721,
0, 0.14311, -0.38164, -1.02566, -0.42934, -0.35779, -0.4532),
baumeisterarbeit = c(-177L, -499L, -88L, -176L, -91L, -460L,
-160L, -213L, -142L, -835L, -391L, 54L, -125L, -143L, -831L,
-102L, 205L, -1291L, -501L, 45L, -338L, 30L, -264L, 1278L,
-911L, -1791L, -1365L, 87L, -9L, -974L, -734L, -264L, -910L,
-1013L, -317L, -382L, -102L, -165L, -89L, -127L, -344L, -812L,
-840L, -151L, -293L, -572L, -381L, 12L, -203L, -584L, -1L,
77L, -204L, -546L, -207L, -205L, -248L), gesamtbaukost = c(-274L,
-384L, -55L, -38L, -90L, -329L, -457L, -110L, -183L, -547L,
-586L, 92L, -202L, -127L, -676L, -168L, -30L, -1057L, -552L,
-138L, -368L, -15L, 32L, 887L, -888L, -1379L, -1134L, 16L,
-92L, -800L, -625L, -261L, -949L, -950L, -559L, -348L, 54L,
-93L, -214L, -336L, -282L, -953L, -816L, -242L, -268L, -483L,
-362L, -27L, -66L, -456L, -189L, 108L, -68L, -429L, -156L,
-235L, -225L), lohn = c(66831L, 66966L, 68594L, 69408L, 69408L,
69408L, 70858L, 71583L, 71583L, 71583L, 73167L, 73959L, 73959L,
73959L, 74575L, 74883L, 74883L, 74883L, 75983L, 76533L, 76533L,
76749L, 78321L, 79107L, 79107L, 79107L, 80423L, 81081L, 81081L,
81081L, 83007L, 83970L, 83970L, 83970L, 85794L, 86706L, 86706L,
86706L, 87566L, 87996L, 87996L, 87978L, 88270L, 88416L, 88416L,
88503L, 90779L, 91917L, 91917L, 91917L, 93727L, 94632L, 94632L,
94632L, 96090L, 96819L, 96819L), resProp.Dwell = c(0.8, -4,
-3.2, 2.7, -1.6, -1, -2.4, -0.4, -0.8, 1, -12.1, 0.2, -5.2,
3.7, -2.7, -1.7, 1.5, 0.7, -7.9, 0.3, 0.3, 1.4, -3.3, -1,
-1.6, 1.5, 0.5, 1.5, -1, -2.2, -3.5, 0.5, 0.5, -0.9, -0.4,
-3.4, 0.9, 0.1, -0.2, -2.8, -0.8, -6.2, 11.3, -4.6, 1, 1.1,
-1.7, 4.1, -5, 2.3, -2.3, 4.6, -6.3, 6.3, -6.9, 0, 2.4),
resProp.Dwell.1 = c(-0.4, -7.5, -1, -2.4, 0, 1.2, 0.7, -4.3,
0, 3.3, -18.3, 11.2, -4.9, 4.9, -0.3, -1.8, 2.7, 0.9, -10.8,
-2.6, 6.1, -0.1, -6.3, 1.2, 0.8, 4.1, -3.5, 4.6, -0.2, -2.7,
-15, 8, -0.1, -0.1, 0.4, -4.9, 0.5, 2.7, -2.5, 1.9, -4.6,
-1, 8.1, -4.5, 0.3, 0.7, 2.2, -0.5, -3.8, 1.8, -4.7, 5.9,
-2, 2.3, -0.4, -1.4, 2.3), resProp.Dwell.2 = c(1.3, -2.5,
-4.2, 5, -2.3, -1.9, -3.7, 1.2, -1.2, 0.1, -9.6, -4.4, -5.4,
3.2, -3.8, -1.5, 0.9, 0.7, -6.7, 1.5, -2.2, 2, -2, -1.8,
-2.7, 0.3, 2.3, 0.1, -1.2, -2.1, 1.5, -2.7, 0.7, -1.3, -0.7,
-2.7, 1, -1, 0.9, -4.9, 0.9, -8.5, 12.7, -4.7, 1.4, 1.2,
-3.4, 6.1, -5.4, 2.4, -1.2, 4, -8.1, 7.9, -9.6, 0.6, 2.4),
resProp.Dwell.3 = c(1.4, -2.5, -5.1, 3.6, -3, -3, -2.6, 1.5,
-1.3, -0.3, -9.2, -6, -6.6, 3, -4.4, -1.2, 1.1, 0.5, -7.1,
1.3, -1.3, 1.7, -1.6, -2.8, -3.5, 0.8, 2.9, 0, -0.3, -2.7,
2.3, -3.3, 1.8, -2, 0.4, -3.8, 1.1, -1.5, 1.3, -5.6, 2.2,
-9.7, 14.3, -5.7, 1.4, 1, -3.6, 7.3, -6.5, 3.1, -2.4, 4.2,
-7.9, 8.3, -10.2, 0.2, 3.6), resProp.Dwell.4 = c(0.9, -2.9,
2.7, 13.7, 3, 5.6, -12, -0.5, -0.2, 2.5, -12, 6.7, 3.1, 4.7,
0.2, -3.6, -0.6, 1.8, -3.6, 2.6, -8.2, 3.8, -4.5, 4.7, 3.4,
-3.4, -1.6, 1.1, -8.5, 2.4, -3.8, 1.4, -7.1, 3.4, -7.5, 4.3,
0.3, 1.9, -1.8, 0.7, -8.5, -0.7, 2.5, 2, 1.4, 2.7, -2.2,
-2, 1.7, -2.2, 6.9, 2.7, -8.8, 4.4, -5.4, 3.8, -5.7), cbre.indu.primeRent = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05, 0.05, 0, 0.1, 0, 0.1,
0, 0.1, 0.05, 0, 0.05, 0.1, 0.1, 0, -0.25, -0.25, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.09, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0), cbre.office.Capital.Value....m.. = c(-64.516129,
-133.83665, -67.861143, -128.947368, -64.43299, -63.11803,
-122.44898, -178.217822, -57.076296, -114.220445, -169.716206,
-52.197802, -57.142858, 0, -114.285714, -257.142857, -189.189189,
-42.953668, -42.193426, -41.453191, 11.441648, 232.919255,
198.701298, 687.160263, -3.906674, -126.31579, -126.315789,
-126.31579, -126.315789, -126.31579, -126.315789, -52.631579,
0, 0, 0, 0, 0, 0, -200, 0, 0, 0, 0, 0, 0, 0, -160, 0, 93.714286,
0, 0, 0, 0, 0, 0, 0, 0), cbre.office.PrimeRent = c(-0.25,
-0.25, 0, -0.25, 0, 0, -0.25, -0.25, 0, -0.25, -0.5, 0, -0.25,
0, -0.5, -0.5, -0.25, 0, 0, 0, 0.25, 0.5, 0.5, 0, -0.5, -0.5,
-0.5, -0.5, -0.5, -0.5, -0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.3, 0, 0.41, 0, 0, 0, 0, 0, 0, 0, 0),
cbre.office.primeYield = c(0, 0, 0.15, 0.15, 0.2, 0.2, 0.2,
0.25, 0.25, 0.25, 0.25, 0.2, 0.15, 0.1, 0.05, 0.15, 0.3,
0.35, 0.4, 0.3, 0.2, 0, -0.15, -0.85, -1, -0.85, -0.75, -0.1,
0, 0, 0, 0.05, 0.05, 0.05, 0.05, 0, 0, 0, 0.2, 0.2, 0.2,
0.2, 0, 0, 0, 0, 0.25, 0.25, 0.25, 0.25, 0, 0, 0, 0, 0, 0,
0), cbre.retail.primeRent = c(0, 0, -5, -5, -2, -3, -4, -4,
-2, -1, 0, 0, -1, -1, -1, -3, -5, -5, -5, -5.5, -5, -5, -5,
-7.5, -8, -11, -13, -10, -9, -6, -4, -2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, -0.33, -0.33, -0.33, -0.33, 0, 0,
0, 0, -7.26, -7.26, -7.26), cbre.retail.primeYield = c(5.25,
5.2, 5.25, 5.3, 5.35, 5.4, 5.4, 5.4, 5.45, 5.5, 5.5, 5.6,
5.65, 5.7, 5.85, 5.95, 6, 6.1, 6.2, 6.25, 6.25, 6, 5.75,
5.25, 5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.75, 4.8, 4.8, 5,
5, 5, 5, 5, 5, 5.25, 5.25, 5.75, 5.75, 5.75, 5.75, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6), cbre.retail.capitalValue = c(-1882.35294,
230.76923, -230.76923, -226.41509, -670.78117, -436.13707,
-222.22223, 0, -205.91233, -202.16847, 0, -393.5065, -403.91909,
-186.30647, -539.81107, -748.11463, -764.70588, -311.47541,
-301.42782, -627.09677, -480, 720, 782.6087, 645.96273, 251.42857,
1386.66667, -533.33334, -533.33333, -533.33333, 0, 0, -1024.56141,
-192.10526, 0, -730, 0, 0, 0, 0, 0, -834.28571, 0, -1450.93168,
0, 0, 0, -700.78261, 0, 0, 0, 0, 0, 0, 0, -1452, 0, 0)), .Names = c("oenb_dependent",
"gdp", "employ", "atx", "un.employ", "carReg", "cpi", "prodPrice",
"productionConstr", "constrPriceIndex", "constrCostTotal", "primConstTot",
"baumeisterarbeit", "gesamtbaukost", "lohn", "resProp.Dwell",
"resProp.Dwell.1", "resProp.Dwell.2", "resProp.Dwell.3", "resProp.Dwell.4",
"cbre.indu.primeRent", "cbre.office.Capital.Value....m..", "cbre.office.PrimeRent",
"cbre.office.primeYield", "cbre.retail.primeRent", "cbre.retail.primeYield",
"cbre.retail.capitalValue"), row.names = c(NA, -57L), class = "data.frame")
> leaps=regsubsets(datSel$oenb_dependent~.,
+ data=datSel, nbest=10)
> plot(leaps, scale="adjr2")
如您所见,无法读取y轴上的文字。有什么建议,如何改变我的情节可以读取数字?
感谢您的回复!
答案 0 :(得分:1)
问题在于绘制leaps:::plot.regsubsets
对象时调用的regsubsets
函数。
第30行是:
axis(2, at = 1:nmodels, labels = signif(yscale[index], 2))
除了修改包的来源之外,没什么可做的。
快速方法是使用
fixInNamespace(plot.regsubsets, ns = "leaps")
编辑该功能,例如将上面的行更改为:
num.labs <- 10
at <- seq(1, nmodels, length.out = num.labs)
lab <- signif(yscale[index], 2)
lab <- lab[seq(1, length(lab), length.out = num.labs)]
axis(2, at = at, labels = lab)