Вы находитесь на странице: 1из 4

aaaaa.

R
ACER

2019-12-24
curahhujan <- read.table("D:/NADIAH/JURNAL TA/skripsi/datastasioner.csv",
header = TRUE, sep = ";")
curahhujan

## tala ktb banjar batola tapin hss


## 1 15,31012737 3,321890058 17,42125139 312,558 3,949715991 14,24605208
## 2 16,9085777 3,840667754 15 278,759 4,059211298 17,49714262
## 3 19,2652537 3,96322646 17,93042108 303,629 4,351887885 20,10348229
## 4 18,40787875 3,931856491 15,7718103 332,1 3,975896284 14,6355731
## 5 15,67960459 3,474602442 16,62828915 192 3,977232127 11,44552314
## 6 17,04406055 3,958404495 14,22146265 252,0625 3,352029613 14,32131279
## 7 13,19090596 3,193985598 12,06233808 104,4 2,652475003 9,343446901
## 8 7,937253933 2,600958164 7,071067812 37,55 3,200254791 5,394441584
## 9 12,81015222 3,335849649 9,785192895 109,75 3,661314363 12,01041215
## 10 14,45683229 3,805620627 16,60572191 277,5 4,039641188 16,55294536
## 11 18,47971861 3,945986064 15,83508762 367 4,621942239 20,22374842
## 12 15,68438714 4,312740565 14,35270009 205,5 4,004095269 18,27566688
## 13 18,26198237 4,271641084 16,10745169 233,5 4,177139648 14,7817455
## 14 15,34811063 3,667918217 13,94632568 198,15 3,697944609 16,20956508
## 15 17,69180601 3,990198407 15,39318031 236,5 3,990198407 18,31665908
## 16 13,71860051 3,941502676 14,60308187 155,95 3,709752991 15,11456251
## 17 18,41195264 3,508351981 15,67641541 227,65 4,063882942 11,7260394
## 18 16,35542723 3,919475921 16,56804153 173,5 3,105422799 12,58967831
## 19 12,08304597 3,698932968 13,36038922 104,5 3,15633164 9,354143467
## 20 11,66190379 3,256777812 6,964194139 123 2,490950988 9,617692031
## 21 12,98075499 2,545729895 9,16515139 13 2,828427125 12,62933094
## 22 15,26433752 3,227434481 11,7686023 137 3,67297394 12,64911064
## 23 15,26433752 3,227434481 11,7686023 137 3,67297394 12,64911064
## 24 20,43281674 4,247542649 17,8325545 348 4,501199794 21,24852936
## 25 18,74833326 3,962362738 16,32482772 315,5 3,760603093 17
## 26 17,79044687 4,340520334 18,62793601 295,4 4,37167186 17,43702956
## 27 16,71077497 5,05363093 19,85321133 356,15 4,018426964 20,03746491
## 28 13,36038922 3,534118843 13,22875656 228,5 4,092448439 14,05346932
## 29 19,97498436 3,578581908 8,544003745 119,5 3,63453502 11,24722188
## 30 16,58312395 4,088796094 10,93160555 77 3,470100082 7,071067812
## 31 8,426149773 3,786194816 10,80509139 45,76112 3,260390439 7,38241153
## 32 8,972179222 2,582795391 8,396427812 9,5 3,204889903 10,70046728
## 33 10,22252415 2,59718478 7,681145748 93,5 2,892507609 7,681145748
## 34 10,74709263 2,545729895 13,80217374 141 2,957436025 10,93160555
## 35 15,96871942 3,616171571 13,85640646 201 3,783889674 15,47578754
## 36 20,50609665 3,631928683 19,6977156 483,5 4,345251154 16,40121947
## hst hsu tabalong tanbu balangan bjm
## 1 15,89339485 2,123878411 14,07302384 5,696254208 14,92481156 16,59819267
## 2 19,089264 2,411560067 18,78696357 5,692215838 16,77796174 15,16575089
## 3 18,21675053 2,429898705 20,29778313 6,169924491 18,82817038 18,09696107
## 4 15,03163331 2,315699719 16,89674525 5,800757934 13,20984481 16,37070554
## 5 14,71393897 2,249316665 13,87443693 5,190175208 16,68831927 16,94107435
## 6 13,67296603 2,347208627 15,43283836 4,945833627 15,14925741 13,03840481
## 7 10,21028893 2,093329079 12,80039062 4,758749274 9,669539803 13,49073756
## 8 9,154233993 2,050534715 9,099450533 4,105119635 11 8,91627725
## 9 15,4029218 2,224181932 12,9034879 5,159055299 14,37010786 10,29563014
## 10 18,24828759 2,387560172 17,02938637 5,283203729 16,59819267 15,8113883
## 11 20,24845673 2,27573518 21,42428529 5,602118821 18,4282392 19,13112647
## 12 18,62793601 2,401081236 18,80159568 5,636573725 17,08800749 23,21637353
## 13 16,38596961 2,345476116 19,45507646 5,744604469 16,86712779 20,32240143
## 14 13,88344338 2,256253089 18,37117307 5,166213526 12,38951169 19,39071943
## 15 17,73414785 2,391030678 17,19011344 5,411646052 14,8492424 19,41648784
## 16 15,19868415 2,410320075 16,30950643 5,451038454 16,89674525 17,2626765
## 17 16,82260384 2,27696917 17,64936259 5,754158682 16,98528775 15,58845727
## 18 13,57387196 2,19274053 11,24722188 5,717027701 12,02081528 10,86278049
## 19 12,82575534 2,226958015 11 4,757891273 9,669539803 13,49073756
## 20 12,84523258 2,107759772 9,848857802 4,879006852 10,63014581 10,09950494
## 21 11,69401556 2,090322428 8,093207028 4,762173935 11,3137085 6,92820323
## 22 13,74772708 1,933305361 13,69306394 4,799914263 14,31782106 13,56465997
## 23 15,68438714 1,933305361 15,85875153 4,912654886 14,31782106 13,56465997
## 24 20,22374842 2,456721684 21,54065923 5,926926026 19,33907961 18,35755975
## 25 17,57839583 2,439660589 11,7686023 5,275560379 14,43952908 16,88194302
## 26 16,14001239 2,322907165 15,19045753 5,779971613 16,07793519 15,795569
## 27 16,4468842 2,431212998 16,95877354 6,487303429 18,09696107 16,41645516
## 28 14,17744688 2,365706742 15,74801575 4,923623917 13,52774926 14,93318452
## 29 11,26942767 2,218924045 12,4498996 5,478553417 11,42365966 5,099019514
## 30 9,565563235 2,163823289 9,772410143 6,067267511 9,246621004 7,874007874
## 31 8,860022573 1,948201527 10,88577053 4,736198448 11,5758369 6
## 32 10,29563014 2,012904605 6,519202405 3,725693427 6,670832032 5,099019514
## 33 10,65363788 2,064625844 7,38241153 4,151039906 8,94427191 3,16227766
## 34 8,246211251 2,0254983 12,16552506 3,921973336 10,07472084 9,695359715
## 35 14,46547614 2,287745363 15,89024858 5,33513134 18,02775638 15,32970972
## 36 16,21727474 2,441517016 17,77638883 5,712081277 18,37117307 20,90454496
## bjb
## 1 34,32876406
## 2 33,60661206
## 3 32,68816643
## 4 35,63310052
## 5 32,62787252
## 6 29,00513108
## 7 22,33563843
## 8 18,80641988
## 9 24,96875356
## 10 27,13874598
## 11 34,9695178
## 12 33,21934403
## 13 36,75538238
## 14 33,99374054
## 15 28,33443524
## 16 32,22553373
## 17 32,38019072
## 18 29,01746357
## 19 22,34819559
## 20 22,05170737
## 21 21,57036682
## 22 23,11793168
## 23 23,11793168
## 24 36,13533304
## 25 35,22296911
## 26 35,6924802
## 27 39,59665291
## 28 27,9924493
## 29 16,76365739
## 30 23,95222928
## 31 17,98885262
## 32 18,17043973
## 33 16,83168258
## 34 22,17967472
## 35 29,21323697
## 36 39,51377204

STAR<-function(curahhujan,W,p){
Series<-ts(curahhujan)
k<-ncol(curahhujan) # Number Location
n<-nrow(curahhujan) # Number Time
zt<-(stack(as.data.frame(t(curahhujan)))[,1]) # Zt with Lag
# Function Create Lag Data
###########################################
MD<-function(zt){
M<-matrix(0,(n*k),k)
z=0
for( i in 1:(n)){
for(j in 1:k){
z<-z+1
M[z,j]<-zt[z]
}
}
M
}
############################################
M1<-MD(zt)
MA<-matrix(0,(n*k-k*p),k*p)
MAW<-matrix(0,(n*k-k*p),k*p)
W1<-kronecker(diag(n), W)
ztw<-W1%*%zt
M2<-MD(ztw)
zt<-as.matrix(zt)
ZT<-zt[-(1:(k*p)),]
for (i in 1:p){
MA[(1:(n*k-k*p)),(k*(i-1)+1):(k*((i-1)+1))]<-M1[(k*(pi)+
1):(n*k-(k*i)),]
MAW[(1:(n*k-k*p)),(k*(i-1)+1):(k*((i-1)+1))]<-M2[(k*(pi)+
1):(n*k-(k*i)),]
}
XT<-MA
WXT<-MAW
star<-data.frame(ZT,XT,WXT)
GSTARfit<-lm(ZT~.-1,curahhujan=STAR)
fit<-summary(STARfit)
MSE<-(fit$sigma)^2
MAE<-sum(abs(STARfit$residuals))/(n*k-k*p)
MAPE<-sum(abs(STARfit$residuals)/ZT)/(n*k-k*p)
MADP<-sum(abs(STARfit$residuals))/sum(ZT)
AIC<-AIC(STARfit)
R2<-fit$r.squared
R2a<-fit$adj.r.squared
Coef<-STARfit$coefficients
Error<-data.frame(MSE=MSE, MAE=MAE, MAPE=MAPE,
MADP=MADP, AIC=AIC, Rsquare=R2, AdjRSquare=R2a)
Coefficient<-data.frame(Coef)
Zt<-as.data.frame(matrix(ZT,n-p,k,byrow=T))
Zhat1<-as.data.frame(matrix(sSTARfit$fitted.values,(np),
k,byrow = T))
Residual<-as.data.frame(matrix(STARfit$residuals,(np),
k,byrow = T))
Result<-data.frame(Zt,Zhat1)
Result<-ts(Result)
windows()
plot(Series,plot.type="single", lty=1:3, col =
4:2,xlab="Time",main="Data Series Plot")
windows()
plot(Result,plot.type="multiple", lty=1:3, col =
4:2,main="Predictive vs Observed")
windows()
plot(Result,plot.type="single", lty=1:3, col = 4:2,main="Predictive vs
Observed")
Residual<-ts(Residual)
windows()
plot(Residual,plot.type="single", lty=1:3, col = 4:2,main="Residual")
Summary<-list(GOF=Error,Fit=fit)
return(Summary)
}