トレンド抽出 修正指数曲線によるトレンド

Equation y_{t}=A-\beta e^{-rt},\;\beta,r>0,Aは漸近値. \ln{(A-y_{t})}=\ln{\beta}-rtR サンプルデータ:1948年から2013年までにおけるアメリカの女性労働参加率 lfpwtrendlfpw
> library(tseries)

> lfpw <- ts(dataset$lfpw,start=c(1948),frequency=1)

> adf.test(lfpw)

        Augmented Dickey-Fuller Test

data:  lfpw
Dickey-Fuller = 0.6711, Lag order = 4, p-value = 0.99
alternative hypothesis: stationary

 警告メッセージ: 
In adf.test(lfpw) : p-value greater than printed p-value

> adf.test(diff(lfpw))

        Augmented Dickey-Fuller Test

data:  diff(lfpw)
Dickey-Fuller = -2.156, Lag order = 3, p-value = 0.5118
alternative hypothesis: stationary

> adf.test(diff(diff(lfpw)))

        Augmented Dickey-Fuller Test

data:  diff(diff(lfpw))
Dickey-Fuller = -6.7553, Lag order = 3, p-value = 0.01
alternative hypothesis: stationary

 警告メッセージ: 
In adf.test(diff(diff(lfpw))) : p-value smaller than printed p-value

> time <- seq(1:length(lfpw))

> kaiki <- lm(lfpw~time)

> lfpwt <- ts(kaiki$fitted,start=c(1948),frequency=1)

> kaiki$coef
(Intercept)        time 
  32.833939    0.484152 

> alpha <- kaiki$coef[1]

> beta <- kaiki$coef[2]

> z <- log(100-lfpw)

> kaiki2 <- lm(z~time)

> yhat <- 100-exp(kaiki2$fitted)

> yhat2 <- ts(yhat,start=c(1948),frequency=1)

> kaiki2$coef
 (Intercept)         time 
 4.228741491 -0.009415256 

> b <- exp(kaiki2$coef[1])

> r <- -1*kaiki2$coef[2]

> time2 <- seq(length(time)+1,length(time)+100)

> est1 <- ts((alpha+beta*time2),start=c(2014),frequency=1)

> est2 <- ts((100-b*exp(-1*r*time2)),start=c(2014),frequency=1)

> plot(lfpw,main="Labor Force Participation Rate.Women.USA.1948-2013")

> plot(lfpw,main="Labor Force Participation Rate.Women.USA.1948-2013",ylab="%")

> ttl <- "Trend Forcast.Labor Force Participation Rate.Women.USA"

> ts.plot(lfpw,lfpwt,est1,yhat2,est2,type="l",lty=c(1,2,2,3,3),main=ttl,ylab="%")

> abline(h=100,col=2)

> han <- c("y=alpha+beta*x","y=A-B*exp(-r*x)")

> legend(1950,90,legend=han,lty=c(2,3),box.lty=1)

参考文献 田中孝文(2008).『Rによる時系列分析入門』.シーエーピー出版.393pp.アプリケーション R Core Team (2013). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/.