[Rライブラリ探索]Rライブラリの探索3(時系列モデル、経済)
使えそうなライブラリ:forecast, wavelets, vars
今日はVAST2010のためにTime Seriesグループのパッケージをやった。
varsパッケージが特に面白そう。
コードはこちら↓
library(forecast) example(plot.ets) example(dm.test) #Diebold-Mariano Test example(accuracy) #以降の予測 example(arfima) example(Arima) #ARIMAモデル example(arima.errors) example(BoxCox) example(croston) #crostonもでる example(fitted.Arima) example(forecast.Arima) example(forecast.HoltWinters) example(forecast.StructTS) example(meanf) example(monthdays) example(na.interp) example(rwf) #random walk forecast example(seasadj) example(seasonaldummy) example(seasonplot) example(ses) example(sindexf) example(splinef) example(thetaf) example(tsdisplay) library(wavelets) example(dwt) #Discrete Wavelet Transform example(modwt) #Maximal Overlap Discrete Wavelet Transform example(extend.series) example(figure108.wt.filter) example(figure98.wt.filter) example(idwt) #dwtの逆変換 example(plot.dwt) example(plot.dwt.multiple) example(plot.modwt) example(squaredgain.wt.filter) #Plot Squared Gain Function example(stackplot) example(wt.filter) library(tsDyn) #Nonlinear time seriese model; Non-linear time series models in empirical finance, Philip Hans Franses and Dick van Dijk, Cambridge:Cambridge University Press (2000) example(AAR) #Additive nonlinear autoregressive example(autotriples.rgl) #3Dグラフ example(BIC) example(LINEAR) #Linear autoregressive model example(llar) #Casdagli test of nonlinearity via locally linear forecasts example(LSTAR) #Logistic Smooth Transition AutoRegressive example(NNET) #Neural Network nonlinear autoregressive example(selectSETAR) #selection of SETAR hyper-param example(SETAR) #Self Threshold Autoregressive example(TVAR) #Multivariate Treshold Autoregressive example(TVAR.LRtest) #Linearity test; http://www.ssc.wisc.edu/~bhansen/papers/cv.htm example(TVECM) #Treshold Vector Error Correction model (VECM) library(MSVAR) #2 stage Markov Switching VAR (Vector Autoregressive) example(MS_Var) #Estimating MS-VAR (時間がかかる) library(mAr) #Multivariate AutoRegressive example(mAr.eig) #推定された係数の固有値 example(mAr.est) #Stepwise least-squares estimation example(mAr.pca) #estimation in reduced PCA space library(vars) example(Acoef) #coefficient of lagged endogenous variables example(causality) #Granger- and Instantaneous causality example(coef) example(normality.test) example(plot) #様々なプロット data(Canada) #OECDが発表したカナダの経済データ var.2c <- VAR(Canada, p = 2, type = "const") plot(var.2c) #Canadian unemployment rate in % 444113DSA #Canadian manufacturing real wage 444321KSA #Canadian consumer price index 445241K #Canadian nominal GDP CAN1008S1 #Canadian civil employment in 1000 persons 445005DSA #prod := 100*(ln(CAN1008S1/445241K)-ln(445005DSA)) #e := 100*ln(445005DSA) #U := 444113DSA #rw := 100*ln(100*444321KSA) example(restrict) example(stability) example(SVAR) #Estimates an SVAR (either ‘A-model’, ‘B-model’ or ‘AB-model’) by using a scoring algorithm example(VAR) example(VARselect)