2017-11-28 20 views
-1

私たちは単変量時系列データを扱っています。MARS:地球パッケージに時系列を当てはめ、結び目を見つける方法

アースパッケージに火星モデルを適合させるにはどうすればいいですか?私は同じことをすることができたと思う。 フィットしたモデルでノットを見つける方法をフィッティングした後。

私はMARSフィットからノットを見つけることができた我々は

library(tsoutliers) 
library(expsmooth) 
library(fma) 
library(tseries) 
library(forecast) 
library(earth) 

setwd("./files/") 
examples <- list.files("./") 
print(examples) 
length(examples) 

labels <- c('Raw', 'Smoothed', 'second time smoothed') 
cols <- c('red', 'yellow', 'blue') 
par(new=TRUE) 
for (i in c(2:10)){ # length(examples) 
    # par(mfrow=2:1) 
    dataseries <- read.csv(examples[i]) 
    series <- ts(dataseries[2], start = 1, end = length(dataseries[,2]),na.omit(daily_data$cnt_ma), frequency = 1) 
    plot(series, col = cols[1], main=examples[i]) 
    smoothedseries <- filter(series, filter=rep(1/140, 140), 
          method= 'convolution', sides=2) 
    lines(smoothedseries, col=cols[2], lwd=2) 

    second <- filter(smoothedseries, filter=rep(1/140, 140), 
        method= 'convolution', sides=2) 
    lines(second, col=cols[3], lwd=2) 
    legend("bottomleft", labels, col=cols, lwd=2) 
    df <- data.frame(smoothedseries) 
    df[is.na(df)] <- 0 
    df1 <- cbind(dataseries[1], df) 
    mars <- earth(x = df1[2], y = df1[1]) 
    plot(mars) 
    #plot.earth.models(mars) 
    #earth_plotmodsel(mars) 
    #print(mars$grsq) 
    # cp <- ts(dataseries[4], start = 1, end = length(dataseries[,4]),na.omit(daily_data$cnt_ma), frequency = 1) 
    # plot(cp, main=examples[i]) 
} 

enter image description here

答えて

0

を使用しているコードを見つけてください。モデル$ cuts [model $ selected_cuts]パラメータを使用すると、

関連する問題