搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  relaimpo.pdf
资料下载链接地址: https://bbs.pinggu.org/a-2699207.html
附件大小:
181.13 KB   举报本内容
我想计算,多元线性回归分析中各个变量的重要程度,就是贡献率"lmg", 其中Package ‘relaimpo’ 可以解决这个问题,包的解释已上传附件,里面有示例 代码install.packages('relaimpo')install.packages('MASS')
install.packages('boot')
install.packages('survey')
install.packages('grid')
install.packages('Matrix')
install.packages('survival')
install.packages('survival')
install.packages('mitools')
#需要安装的所有包

data(swiss)
# bootstrapping(引导)
bootswiss <- boot.relimp(swiss, b = 100,
type = c("lmg", "last", "first", "pratt"),
rank = TRUE, diff = TRUE, rela = TRUE)
# for demonstration purposes only 100 bootstrap replications
#alternatively, use formula interface
bootsub <- boot.relimp(Fertility~Education+Catholic+Infant.Mortality, swiss,
subset=Catholic>40, b = 100, type = c("lmg", "last", "first", "pratt"),
rank = TRUE, diff = TRUE)
# for demonstration purposes only 100 bootstrap replications
#default output (percentily intervals, as of Version 2 of the package)
booteval.relimp(bootswiss)
plot(booteval.relimp(bootswiss))
#sorted printout, chosen confidence levels, chosen interval method
#store as object
result <- booteval.relimp(bootsub, bty="bca",
sort = TRUE, level=c(0.8,0.9))
#because of only 100 bootstrap replications,
#default bca intervals produce warnings
#output driven by print method
result
#result plotting with default settings
#(largest confidence level, names abbreviated to length 4)
plot(result)
#result plotting with modified settings (chosen confidence level,
#names abbreviated to chosen length)
plot(result, level=0.8,names.abbrev=5)
#result plotting with longer names shown vertically
par(las=2)
plot(result, level=0.9,names.abbrev=6)
#plot does react to options set with par()
#exceptions: mfrow, mar and oma are set within the plot routine itself
#示例代码,其中数据(swiss)是R语言自带数据文件 (瑞典地区不同因素对出生率的影响) 把以上的包安装好,把代码全部复制粘贴就可以得到lmg

我现在的问题是,想把自己的数据带入这个代码中替换瑞典的数据,但是总是出错

我的数据已上传附件,求其他变量对第一列数据RPR的影响程度 ,求大神帮我把我的数据带进去得出“lmg“






    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

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

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

GMT+8, 2026-1-9 17:55