_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 襦覯ろ誤蠏覿

Contents

1
2 豸, 襤郁規螳, plotting
3 谿瑚襭


1 #

m1 <- rlm(dau ~ x, data=tmp) #覯 M豢
m2 <- lqs(dau ~ x, method="lms", data=tmp) #LMS: Least Median of Squares
m3 <- lqs(dau ~ x, method="lts", data=tmp) #LTS: Least Trimmed Squares, 伎豺襦 豢 螳 覯襴螻 蠏覿
m4 <- lqs(dau ~ x, method="lts", quantile=8, data=tmp) #9,10 覿 企豪 螳 覯襴螻 蠏覿
boxplot(m1$resid, m2$resid, m3$resid, m4$resid)

2 豸, 襤郁規螳, plotting #

target <- "s"

if (target == "l"){
    xx <- seq(1:nrow(long_term))
    tmp <- data.frame(x = seq(1:nrow(long_term)), dau=long_term$dau)
} else {
    xx <- seq(1:nrow(short_term))
    tmp <- data.frame(x = seq(1:nrow(short_term)), dau=short_term$dau)
}


fit1 <- rlm(dau ~ x, data=tmp)
fit.data <- data.frame(predict(fit1, data.frame(x=xx), interval="prediction", level=.95))
newdata <- data.frame(x = (max(xx)+1):(max(xx)+7)) 
pred1 <- data.frame(predict(fit1, newdata, interval="confidence", level=.95))

d1 <- data.frame(x=xx, dau=tmp$dau)
d2 <- data.frame(x=newdata, dau=pred1$fit)
d <- sqldf("
select * from d1 
union all
select * from d2
")
plot(d)

lines(xx, fit.data$fit, col="black")
lines(xx, fit.data$lwr, col="blue")
lines(xx, fit.data$upr, col="red")

lines(newdata$x, pred1$fit, col="black", lty="dashed")
lines(newdata$x, pred1$lwr, col="blue", lty="dashed")
lines(newdata$x, pred1$upr, col="red", lty="dashed")

蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

殊 蟾讌 覈詩企 譬. る 豌覿 蠍壱 螳襷 讌 襷. 蠏碁蟆 蠏 殊 襷♀鹸 語 襷 覯襴讌 . <覓企>