| 所在主题: | |
| 文件名: Sunspots.xlsx | |
| 资料下载链接地址: https://bbs.pinggu.org/a-2865035.html | |
| 附件大小: | |
|
明天交作业...共8论坛币,若不足可以微信,谢谢!
Exercise 3 Consider the data set from the file sunspot.XLSX. This set contains sunspots, which are “are temporary phenomena on the Sun's photosphere that appear as spots darker than the surrounding areas” [Wikipedia]. a) Are there missing values? If yes, how to replace them? Carry your idea out. b) Are there outliers or irregular values? Check and if yes, please filter. c) Is there are trend and other deterministic effects? Please extract trend and seasonality. Exercise 4 Consider the data set from the file sampleSeries.xlsx. a) Fit an appropriate time series model to the data set. Describe your decisions. b) Create a set of 1000 simulations with length 500. 以上是原题,以下是我的code,问题是C)和4a)b),在最底下 #3. #a) library(readxl) sunspots<-read_excel("C:/Users/Pretty-PC/Desktop/Homework_Assignment/Homework_Assignment/Sunspots.xlsx") sun<-as.numeric(unlist(sunspots[,3])) sum(is.na(sun)) lag=10 ma = numeric(length(sun)) for (k in (lag+1):(length(sun)-lag)) { ma[k]<-mean(sun[(k-lag):(k + lag)],na.rm=TRUE) } plot(sun,type="l") lines(ma,col="blue") sum(is.na(sun)) sum(is.na(ma)) sun<-ma #b) x=sun[1:2000] y=sun[1:2000]-mean(sun[1:2000]) z=diff(lag(x)) plot(z,type="l") mean(z) var(z) sd(z) a=z/sd(z) plot(a,type="l") sd(a) y<-z[(z>-0.1)&(z<+0.1)] plot(y,type = "l") sd(y) y<-numeric(length(z)-1) counter=1 for(k in 1:length(z)) { if(z[k]>-0.3) { y[counter]=z[k] counter-counter+1 } else { } } #c)如何取趋势.... for(k in 2:length(x)) { epsilon=rnorm(1,mean=0,sd=0.5) sun[k]=sun[k-1]+epsilon } plot(x,type="l") #4.???求助如何选模型 |
|
熟悉论坛请点击新手指南
|
|
| 下载说明 | |
|
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。 2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。 3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。 (如有侵权,欢迎举报) |
|
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明