- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 520 个
- 通用积分
- 11.4676
- 学术水平
- 1 点
- 热心指数
- 0 点
- 信用等级
- 0 点
- 经验
- 305 点
- 帖子
- 29
- 精华
- 0
- 在线时间
- 29 小时
- 注册时间
- 2019-4-11
- 最后登录
- 2022-1-16
|
martylife 发表于 2020-5-7 11:27 
楼主能否看一下我发的求助帖子?关于坐标轴数字方向调整问题。 你用的那个函数包很烂,不take las argument (shame on the authors)。 我稍微改进了一下, 在以下函数放进R里,然后:
plot.regsubsets(leaps,scale="adjr2")
你可以选择xlas 和ylas的值任意调整方向。 - plot.regsubsets<-function(x,labels=obj$xnames,main=NULL,
- scale=c("bic","Cp","adjr2","r2"),
- col=gray(seq(0,0.9,length=10)),xlas=1, ylas=1){
- obj<-x
- lsum<-summary(obj)
- par(mar=c(7,5,6,3)+0.1)
- nmodels<-length(lsum$rsq)
- np<-obj$np
- propscale<-FALSE
- sscale<-pmatch(scale[1],c("bic","Cp","adjr2","r2"),nomatch=0)
- if (sscale==0)
- stop(paste("Unrecognised scale=",scale))
- if (propscale)
- stop(paste("Proportional scaling only for probabilities"))
-
- yscale<-switch(sscale,lsum$bic,lsum$cp,lsum$adjr2,lsum$rsq)
- up<-switch(sscale,-1,-1,1,1)
-
- index<-order(yscale*up)
-
- colorscale<- switch(sscale,
- yscale,yscale,
- -log(pmax(yscale,0.0001)),-log(pmax(yscale,0.0001)))
-
- image(z=t(ifelse(lsum$which[index,],
- colorscale[index],NA+max(colorscale)*1.5)),
- xaxt="n",yaxt="n",x=(1:np),y=1:nmodels,xlab="",ylab=scale[1],col=col)
-
- laspar<-par("las")
- on.exit(par(las=laspar))
- par(las=2)
- axis(1,at=1:np,labels=labels, las = xlas)
- axis(2,at=1:nmodels,labels=signif(yscale[index],2), las = ylas)
-
- if (!is.null(main))
- title(main=main)
- box()
- invisible(NULL)
- }
复制代码
|
-
总评分: 论坛币 + 10
查看全部评分
|