全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
6329 4
2018-10-13
这是《R语言实战》一书中的代码:

library(car)
states<-as.data.frame(state.x77[,c("Murder","Population","Illiteracy","Income","Frost")])
fit<-lm(Murder~Population+Illiteracy+Income+Frost,data=states)
influencePlot(fit, id.method="identify" ,main="Influence Plot",
              sub="Circle size is proportional to Cook's distance")

我在r中输入这代码一直提示"id.method"不是图形参数,然后书上面说id.method="identify" 会产生图形交互,点击图上的点会标注函数中label选项的设定值,但是图上根本没有产生交互式绘图,点击也没反应。

我的car包是3.0.2版本,是不是版本的问题?



二维码

扫码加我 拉你入群

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

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

全部回复
2018-11-11 16:30:06
记得以前可以的,最近重新看看也遇到这个问题,是不是改了之类
二维码

扫码加我 拉你入群

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

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

2019-1-21 22:43:13
今天用3.5.2版本 遇到同样的问题
二维码

扫码加我 拉你入群

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

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

2019-5-7 22:38:52
今天也遇到了这个问题,看文档后发现使用方法变了。
Usage
influencePlot(model, ...)

## S3 method for class 'lm'
influencePlot(model, scale=10,  
xlab="Hat-Values", ylab="Studentized Residuals", id=TRUE, ...)
Arguments
model        
a linear or generalized-linear model.

scale        
a factor to adjust the size of the circles.

xlab, ylab        
axis labels.

id        
settings for labelling points; see link{showLabels} for details. To omit point labelling, set id=FALSE; the default, id=TRUE is equivalent to id=list(method="noteworthy", n=2, cex=1, col=carPalette()[1], location="lr"). The default method="noteworthy" is used only in this function and indicates setting labels for points with large Studentized residuals, hat-values or Cook's distances. Set id=list(method="identify") for interactive point identification.

...        
arguments to pass to the plot and points functions.
所以现在调用,可以采用这种方式,如:
influencePlot(fit, id=list(method="identify"), main="Influence Plot", sub="Circle size is proportional to Cook's distance")
二维码

扫码加我 拉你入群

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

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

2020-7-18 11:38:36
qimingxingwen 发表于 2019-5-7 22:38
今天也遇到了这个问题,看文档后发现使用方法变了。
Usage
influencePlot(model, ...)
牛逼{:3_59:}
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群