楼主: 李李慕
1835 2

[问答] 想用r语言rpart做回归树,但是结果很奇怪,我没有接触过这种问题,求大神帮助 [推广有奖]

  • 0关注
  • 0粉丝

小学生

57%

还不是VIP/贵宾

-

威望
0
论坛币
6 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
53 点
帖子
3
精华
0
在线时间
9 小时
注册时间
2017-11-15
最后登录
2018-4-18

楼主
李李慕 发表于 2017-11-21 23:10:50 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

>
print(model)n= 68 node), split, n, deviance, yval      * denotes terminal node1) root 68 72049750.0 1051.1520    2) x2< 21759.15 48  6881635.0  478.8652      4) x2< 9920.71 31   736981.7  247.5813 *    5) x2>=9920.71 17  1462508.0  900.6182 *  3) x2>=21759.15 20 11718150.0 2424.6400      6) x2< 42085.99 13  1467165.0 1958.6830 *    7) x2>=42085.99 7  2186680.0 3289.9890 *
> summary(model)Call:rpart(formula = y ~ ., data = Data1_train, method = "anova")  n= 68           CP nsplit  rel error    xerror       xstd1 0.74184807      0 1.00000000 1.0358085 0.202789762 0.11192687      1 0.25815193 0.3265755 0.073796943 0.06498489      2 0.14622506 0.2998811 0.059809724 0.01000000      3 0.08124017 0.2437445 0.05804903Variable importance x2 x13  x1 x15 x11 x16  x3  x6  x7  x8  19  17  16  14  13  13   3   2   2   1 Node number 1: 68 observations,    complexity param=0.7418481  mean=1051.152, MSE=1059555   left son=2 (48 obs) right son=3 (20 obs)  Primary splits:      x2  < 21759.14 to the left,  improve=0.7418481, (0 missing)      x11 < 10843.62 to the left,  improve=0.7385662, (0 missing)      x13 < 6012.35  to the left,  improve=0.7351267, (0 missing)      x1  < 33868.23 to the left,  improve=0.7196785, (0 missing)      x15 < 1665.815 to the left,  improve=0.7147013, (0 missing)  Surrogate splits:      x13 < 7030.545 to the left,  agree=0.985, adj=0.95, (0 split)      x1  < 33868.23 to the left,  agree=0.971, adj=0.90, (0 split)      x11 < 10843.62 to the left,  agree=0.971, adj=0.90, (0 split)      x15 < 1665.815 to the left,  agree=0.971, adj=0.90, (0 split)      x16 < 1675.575 to the left,  agree=0.956, adj=0.85, (0 split)Node number 2: 48 observations,    complexity param=0.06498489  mean=478.8652, MSE=143367.4   left son=4 (31 obs) right son=5 (17 obs)  Primary splits:      x2  < 9920.71  to the left,  improve=0.6803827, (0 missing)      x1  < 11951.67 to the left,  improve=0.6674938, (0 missing)      x8  < 463.99   to the left,  improve=0.6541561, (0 missing)      x13 < 3268.28  to the left,  improve=0.6229007, (0 missing)      x15 < 794.645  to the left,  improve=0.6055114, (0 missing)  Surrogate splits:      x1  < 11951.67 to the left,  agree=0.958, adj=0.882, (0 split)      x3  < 8.4      to the left,  agree=0.917, adj=0.765, (0 split)      x13 < 3013.85  to the left,  agree=0.917, adj=0.765, (0 split)      x15 < 700.805  to the left,  agree=0.917, adj=0.765, (0 split)      x8  < 305.85   to the left,  agree=0.896, adj=0.706, (0 split)Node number 3: 20 observations,    complexity param=0.1119269  mean=2424.64, MSE=585907.4   left son=6 (13 obs) right son=7 (7 obs)  Primary splits:      x2  < 42085.99 to the left,  improve=0.6881892, (0 missing)      x13 < 13104.1  to the left,  improve=0.6881892, (0 missing)      x7  < 24542.87 to the left,  improve=0.6686660, (0 missing)      x11 < 19498.24 to the left,  improve=0.6686660, (0 missing)      x15 < 3545.47  to the left,  improve=0.6686660, (0 missing)  Surrogate splits:      x13 < 13104.1  to the left,  agree=1.00, adj=1.000, (0 split)      x3  < 30.455   to the left,  agree=0.95, adj=0.857, (0 split)      x1  < 67920.46 to the left,  agree=0.90, adj=0.714, (0 split)      x6  < 77.4     to the right, agree=0.90, adj=0.714, (0 split)      x7  < 22724.44 to the left,  agree=0.90, adj=0.714, (0 split)Node number 4: 31 observations  mean=247.5813, MSE=23773.6 Node number 5: 17 observations  mean=900.6182, MSE=86029.9 Node number 6: 13 observations  mean=1958.683, MSE=112858.8 Node number 7: 7 observations  mean=3289.989, MSE=312382.8


这样的结果是对的吗?还是我程序写的有问题?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:论坛 统计 求助

沙发
糯米JI 发表于 2017-11-23 15:27:26
程序没问题,但是不知道你是哪里看不懂.

藤椅
李李慕 发表于 2017-11-23 21:37:06
糯米JI 发表于 2017-11-23 15:27
程序没问题,但是不知道你是哪里看不懂.
我想问一下,minsplit,cp,maxcompete,maxdepth这些参数该怎么设置呢,我怎么知道什么时候参数是合理的?谢谢!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 23:23