全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3024 1
2015-10-27
悬赏 200 个论坛币 未解决
刚接触R不久,只懂得一些浅显的基础知识,这边有一组关于时间序列的图片比较困惑,希望大神们可以帮我解释一下。下面是R的程序,然后是doc文档中是plot图,希望可以有比较详细的解释.
> par(mfrow=c(1,1))
> plot(bicoal.tons,xlab="Year",ylab="Production in Millions of  Net Tons of Bitumous Coal",pch="*",type="b",main="Production of Bitumous Coal Between 1920 and 1968")
> xt<-time(bicoal.tons)-1945
> mod<-rlm(bicoal.tons~cbind(xt,xt^2))
> mod$coefficients
        (Intercept)   cbind(xt, xt^2)xt cbind(xt, xt^2)xt^2
       472.51468692          0.29658002          0.02902045
> plot(mod$residuals,xlab="Year",ylab = "Production in Millions of  Net Tons of Bitumous Coal",pch="*",type="b",main="Production of Bitumous Coal Between 1920 and 1968")
> Ident(mod$residuals,"Detrended Bitumous Coal Data","Raw Scale")
> fin<-Raic(mod$residuals)
> par(mfrow=c(1,1),oma=c(4,0,6,0))
> c1<-2/sqrt(length(bicoal.tons))
> plot(fin$k,diag(fin$coef),ylim = range(diag(fin$coef),c1,-c1),type = "b",lty=2,main="Robust PACF",xlab = "Autorefression Order",ylab = "Robust PACF")
> box(lty = 1)
> abline(h=c(-c1,c1),lty=2)
> abline(h=0)
> segments(fin$k,0,fin$k,diag(fin$coef))
> mtext("Identification for the Bitunous Coal Data,Quadratic Trend Fitted",3,1,outer = T,cex = 1.5)
> fin$coef[1,1]
[1] 0.7195047
> res<-fin$resid[,1]
> fv<-mod$residuals[-1]-res
> Ident(res,"Bitumous Coal Data","residuals from Quadratic Trend and AR(1) fit")
> fin2<-Raic(res)
> par(mfrow=c(1,1),oma=c(4,0,6,0))
> c1<-2/sqrt(length(bicoal.tons))
> plot(fin2$k,diag(fin2$coef),ylim = range(diag(fin2$coef),c1,-c1),type = "b",lty=2,main="Robust PACF",xlab="Autoregression Order",ylab = "Robust PACF")
> box(lty=1)
> abline(h=c(-c1,c1),lty=2)
> abline(h=0)
> segments(fin2$k,0,fin2$k,diag(fin2$coef))
> mtext("Identification for the Bitumou Coal Data,Quadratic trend and AR(1) Fitted",3,1,outer = T,cex = 1.5)
> par(mfrow=c(2,2),oma=c(0,0,6,0))
> plot(1:(length(bicoal.tons)-1),res,type="b",pch="*",xlab="Time",ylab="Residuals",main="Residual Plot")
> plot(fv,res,main="Residuals Versus Fitted Values",ylab="Residuals",xlab = "Fitted Values")
> qqnorm(res,main="Quantile-Quantile Plot",ylab="Residuals",xlab = "Gaussian Quantiles")
> plot(fv,abs(res),main="Absolute Residuals Versus Fitted Values",ylab = "Absolute Residuals",xlab = "Fitted Values")


> lines(lowess(fv,abs(res)))
> mtext("Residual Plots from quadratic trend and AR(1) fit to the Bitumous Coal Data",outer = T,side = 3,cex = 1.5)



R plot 1.docx

大小:180.23 KB

 马上下载

二维码

扫码加我 拉你入群

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

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

全部回复
2017-10-21 22:55:23
楼主这个会了么 我们也有这道题
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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