我想绘制一个函数的结果。我的代码是这样的:
library(caret)
#-----------------------------------------------------------------------------
#K-folds resampling method for fitting svr
ctrl <- trainControl(method = "repeatedcv", number = 10, repeats = 10,
allowParallel = TRUE) #10 separate 10-fold cross-validations
marsFitcv <- train(R ~ ., data = trainSet,
method = "earth",
tuneGrid = expand.grid(degree = 1:2, nprune = 40:100),
trControl = ctrl)
xyplot(testSet$R ~ predict(marsFitcv, testSet),
## plot the points (type = 'p') and a background grid ('g')
type = c("p", "g","smooth"),
xlab=list(label = "Predicted",cex = 2), ylab = list(label = "Observed",cex = 2),
scales = list(cex = 1.5, tick.number = 12),
lwd=5)
结果是:
哪个不太好。我曾尝试使用刻度来改变轴的格式和外观(角度,小数位),但我没有成功提高质量。
有什么想法吗?感谢
trainSet:
head(trainSet)
fy fu E eu imp_local imp_global teta1c k1c
7 317.913756282 538.9628966830001 194617.707566 0.153782620813 1555.345095700 594.038972858 0.033375064111 4000921.555520000
8 365.006253069 484.4231205890000 181322.455065 0.208857408687 1595.416140440 1359.482165290 0.021482368218 4499908.419790000
20 392.548100067 607.9749819190000 206661.286272 0.299332556040 763.563924180 1018.892093670 0.020905367537 9764999.269020000
23 305.350697829 566.4619090980000 182492.029532 0.277013319499 1716.782777310 850.887850177 0.006956337817 9273400.461589999
28 404.999341917 580.2878558010000 189867.929239 0.251278125174 1045.724296160 1381.355737200 0.034913536977 6163057.888550000
29 326.558279739 454.1783167940000 181991.379749 0.200125258050 802.742305814 1714.663514620 0.030097702230 12338543.570300000
k2_2L k2_3L k2_4L bmaxc dfactorc amaxc teta1s k1s
7 98633499.56820001 53752551.02620000 56725106.5978 3481281.32908 2.54747298950 73832.97467630000 0.015467320192 5049506.54552
8 53562216.54960000 125020222.79400000 126865701.8930 4393584.00639 2.94296926288 99150.50689970001 0.013675755546 11250622.68420
20 51597126.68660000 124021434.48199999 145764489.6640 2614830.02391 2.79505551368 77165.43385079999 0.031668366149 13852560.50890
23 79496746.00980000 125817803.43099999 64837586.8755 3128593.72039 2.47882735165 128546.99647100001 0.028898297322 18813117.57260
28 54060378.63340000 75021821.67020001 49128911.0832 3179348.29527 2.46407943564 53819.04475330000 0.019211801086 18362782.73720
29 88854286.54570000 35160224.28800000 70088564.0166 4274637.35956 1.41121223341 54870.97071060000 0.013349768955 14720875.08290
k2_ab1s k2_ab2s k2_ab3s bmaxab1 bmaxab2 ab1 ab2 dfactors teta1f
7 276542468.441 108971516.033 33306211.9166 4763935.86742 1864128.64700 66.4926766666 21.0285105309 2.478039219470 0.037308451805
8 275768806.723 114017918.320 28220338.4744 4297372.01966 1789714.60470 42.7771212442 23.5869838719 0.874644748155 0.035718600749
20 211613299.608 248886114.151 40462423.2281 3752983.00638 2838412.50704 45.4212664748 18.8524808986 0.749837099991 0.012495093438
23 264475187.749 213529935.615 23450400.4429 4861240.46459 2122535.96812 50.3764074404 10.1121885612 1.967115891850 0.000815957999
28 162043062.526 236891513.077 46044346.1128 4269771.84810 2512362.60884 35.4792060556 10.9695055644 2.540777435200 0.002155991091
29 252936228.465 142986118.909 23695405.2598 4162098.23435 1176995.61871 34.1116517971 12.1154127169 1.285543793330 0.025791044690
k1f k2f bmaxf dfactorf k2b amaxb dfactorb roti rotmaxbp
7 14790480.98710 55614283.97600000 2094770.19484 0.745459795314 1956.92858062 38588.0915097000 0.822346959126 16.15603900490 0.235615453341
8 17223538.18530 54695745.77620000 3633133.51482 2.048691769330 1400.78738327 35158.1672213000 2.344213548480 12.72239713860 0.343204895932
20 19930679.89310 86690362.70360000 1361188.05421 0.853221909609 1771.23607857 25711.0627820000 0.799906353320 6.43238062144 0.370304533553
23 3524230.46974 99857853.73119999 2001027.51219 1.766524101190 1104.05501369 21103.1603387000 2.990704472990 15.88255226700 0.488746319999
28 15721827.01370 63119072.71100000 2534273.67260 0.523675021418 1756.67671930 27230.6973685000 1.763730315990 16.08362526630 0.176135112774
29 13599317.03710 37510791.54720000 3765850.14143 1.080876861300 1509.92949560 43720.3558889999 1.386402232490 18.27348328930 0.469219990010
R
7 0.022186087
8 0.023768855
20 0.023911029
23 0.023935705
28 0.023655335
29 0.022402726
testSet:
head(testSet)
fy fu E eu imp_local imp_global teta1c k1c
2 498.601042547 618.515701088 198169.824792 0.292617232468 1805.113916500 1878.7380272000000 0.014331189233999999 15132960.97620
4 454.746058709 489.892744502 191759.511081 0.295145634152 1544.660494900 982.5539416410001 0.035893469620999999 6410772.49211
5 301.951988712 564.021764465 212398.220872 0.147597621931 935.893229951 427.7492510110000 0.012307261738000000 3791664.02823
6 461.045807700 516.378017109 194063.413068 0.161608811981 1382.402845670 1093.6241599400000 0.011291235565000000 14474344.87820
9 453.554600402 596.057750034 210063.730922 0.257893061753 394.237147042 1493.5773377300000 0.009488447553999999 10340725.62950
12 492.036782668 517.849599094 183149.565869 0.167847183914 1279.870138570 1246.6234205300000 0.016826362699000001 19827344.45080
k2_2L k2_3L k2_4L bmaxc dfactorc amaxc teta1s k1s k2_ab1s
2 78394978.71020000 120079436.1980 146158245.1480 1745729.77265 0.76864435182 99825.07224670000 0.005389107904 11029479.45850 281018624.227
4 89597132.72830001 86825455.5081 30469362.2409 2722378.85705 2.09169602976 113310.58877600000 0.018009473151 11915264.31100 258018806.953
5 94428579.45479999 123566566.3690 57548067.1583 2208785.36620 1.29582667617 31483.02952620000 0.004415397896 4868826.66168 213693759.851
6 32921024.78960000 99240177.8678 44042923.2628 1535720.93273 2.41503143601 66723.89322319999 0.037476837711 13722088.94730 242645790.573
9 46630555.27760000 42538780.7812 62413831.7184 2520896.92364 1.02998694158 121157.96210000000 0.000564272060 10594822.12880 277511053.075
12 61909813.66680000 111786299.1020 100725140.3600 3951697.77161 2.38541121007 38524.23159040000 0.025355469090 17036482.93670 226554678.727
k2_ab2s k2_ab3s bmaxab1 bmaxab2 ab1 ab2 dfactors teta1f k1f
2 180911241.441 34782554.7304 2265950.08765 2703211.29052 41.5341478815 20.9210019557 1.735126957230 0.003790603775 9415994.18588
4 147998476.162 26611139.3464 4943511.48891 1357404.69411 32.0846768633 18.1351853101 2.970626989170 0.001807375768 7789526.66836
5 245066061.356 31088132.5921 3852148.16430 2384242.22289 58.8615725541 15.5069203626 0.562741760633 0.012026690472 14384309.92210
6 137372442.788 32927069.6791 3779926.46663 2415165.55565 49.5220696239 19.6062701895 1.612354606110 0.038980920766 11937566.36680
9 208941461.195 45906169.2902 3047797.50357 1329608.98731 39.0791784235 18.0138710628 2.961455388030 0.029127145971 7869306.35586
12 175592865.987 46898468.3880 3508980.33878 1896289.86223 33.7669280187 28.7353619080 1.540802524880 0.018733699891 2719272.29023
k2f bmaxf dfactorf k2b amaxb dfactorb roti rotmaxbp R
2 90723005.8231 1470648.41665 2.873736734350 1408.47184218 47845.6837008 0.780456891275 14.713807074900000 0.454230793708 0.027260400
4 64206771.6952 3699207.00615 0.610513412361 1246.82344357 47323.2485278 1.126275807000 9.845277692210001 0.262215939569 0.026510509
5 66731694.9966 2999062.29314 1.276190418690 1072.87147922 31255.1079088 1.417515670450 19.340988681300001 0.256307153833 0.024937268
6 83556881.6345 3413102.28343 2.682147547050 1910.37327268 17486.6770506 0.887458775228 14.319966216099999 0.345863824346 0.027085085
9 21549589.5515 3224292.50076 2.579638037970 1039.60667133 26744.9306962 1.563123032880 11.597269051200000 0.327343902618 0.028273344
12 68594211.6234 1381870.91221 2.900315043860 1719.41756700 22692.2330043 2.485716426890 13.117815966300000 0.299914003273 0.029109497