SlideShare a Scribd company logo
1 of 34
Try Test (S) on R 
Analyzing Time-Series Data 
2014.9.3
We introduce our R functions 
You should be able to: 
• Testify stationary of time series Z(n) 
• Identify fracture points of stationary time series Z(n) 
• Compute determinacy and causality values of Z1(n) and Z2(n) 
• Visualize the results using R plot functions 
• Apply these tests to various time series data 
2
Goals 
• Using Statistics Programing language R 
• Prototyping Each Test 
• Stationary Test: Test(S) 
• Abnormality Test: Test(ABN) 
• Determinacy Test: Test(D) 
• Causality Test: Test(ES) 
• Merits 
• Easy to handle 
• Apply the tests to various data 
• Spread the theory throughout the world
History of Prototyping 
• These tests are developed as 
– Basic Programs By Prof 
• Test(S) , Test(ABN) 1988~ 
• Test(ES), Test(D) 2004~ 
– Java Programs (Converted from the Basic Programs) 
• Test(S) , Test(ABN) 2009 ~ Test(ES), Test(D) 2011 ~ 
• Java programs have high performance. 
However, require programming skills 
4
History: Prototyping Tests 
• Developed by 
– Basic Programs By 
• 1988 ~ 
– Java Programs By 
• 2009 ~ 
• R scripts + java class ( using Rjava ) By 
• 2012~ 
(continued) 
5
Merits using R 
1. Usability: Easy to handle 
2. Data processing Performance 
3. Powerful Visualization 
6
Demonstration of TestS-R 
7
1 Easy to handle 
$testABN(ts, term) 
> testABN(M2CD, term=98) 
Time Series Length = 186 
Term = 98 
1 1 0 1 0 0 3 1 0 4 14 19 15 16 18 9 9 12 12 9 7 4 1 2 
1 1 1 4 4 3 2 1 3 4 8 16 12 11 5 6 7 5 5 3 3 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 2 6 35 103 84 81 
88 89 77 66 77 59 60 50 55 87 84 96 88 51 43 
• M2CD denotes a money supply data in Japan (1955q3 – 2001q4) 
• Provided function $testABN calls Java class testS
1 Easy to handle 
$testD(ts1, ts2, term) 
(continued) 
> testD_result<-testD(GDP, M2CD, 183) 
> testD_result$result[4,] 
[1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 
…………………………………………………(skip)……………………………… 
[162] 0.0000000 0.0000000 0.0000000 0.7482668 0.8520689 0.8561230 0.8512788 
[169] 0.8785611 0.8996980 0.9045383 0.8903662 0.8810984 0.8808611 0.8864593 
[176] 0.9035437 0.8871590 0.8862733 0.8848502 0.8751460 0.8882548 0.8878465 
[183] 0.8835506 0.8778081 
• GDP denotes also Japan Nominal GDP data (1955q3 – 2001q4) 
• testD_result$result[4,] denotes the Determinacy value of V3(n)
Data Accessing 
• testD_result is a data frame of matrix of R 
testD_result$result[4,] 
Row Access 
Column Access 
testD_result$result[4,] 
Dataframe_id$filed_id
2 Data processing Performance 
$scan, $log, $diff, $scale, $scale2 
> M2CD <-scan("M2CD.DAT") 
• Input M2CD data file 
> M2CD_ld <- diff(log(M2CD)) 
Various data processing support: Log transformation, First difference 
and Standardization. M2CD_ld is used for test(ABN).
2 Data processing Performance 
$plot, $ts 
>M2CD <-scan("M2CD.DAT") 
>plot(ts(M2CD, start=1955.5,,frequency=4)) 
(continued)
2 Data processing Performance 
$plot, $ts, $log 
>plot(ts(log(M2CD), start=1955.5,,frequency=4)) 
(continued)
2 Data processing Performance 
$plot, $ts, $diff 
>plot(ts(diff(log(M2CD)), start=1955.5,,frequency=4)) 
(continued)
3 Visualization 
$plotTestD(result, start) 
> GDP <-scan("NGS-II.DAT") 
> M2CD <-scan("M2CD.DAT") 
>testD_result<-testD(GDP, M2CD, 183) 
>plotTestD(testD_result, 4, 1955.5) 
>abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
Try Test(ABN), Test(D) with R 
16
Non linear transformation 
$NLtransform(ts) 
> NLtransform (diff(log(M2CD)) 
…………………..Return value………………………………….. 
• Test(S) and Test(ABN) uses non–linear transformation up 
to rank 6, which constructs 19 one-dimensional time 
series ψi(Z(f)) from Z(n). 
• $NLtransform returns 19 transformed time series as data 
frame.
Stationary Test: $testS 
$testS(ts, term) 
> testS(diff(log(M2CD[1:99])), d=1) 
Dimension d= 1 
Time Series Length = 99 
Test(S) Passed 
[1] 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 
Time Series [2], [3], [5], [7], [18] is passed by TEST(S) is passed and considered 
stationary. 
• $TestS is applied to a subsequence of log- and diff-transformed 
M2CD, whose data length is 99. ->M2CD[1:99]
Stationary Test 
• Test the stationarity of the target time series 
– Repeats Test(S) about subsequence TERM 
– The length of TERM is set to 98: Economical Data 
• $TestS returns an array of test(S) results about 19 
transformed time series ψi(Z(f)) 
– one dimension: 19 results of 1d-test(S) for ψi(Z(f)) 
– Two dimension: results of 2d-test(S) for (ψi(Z(f)), ψj(Z(f))) 
19
Test(S) : Preliminary 
• Time Series Data Z(m) 
– Sample mean vector μZ , 
– Sample covariance matrix function RZ 
20
Test(S): Conditions 
21 
• Three Test Values (M) (V) (O) 
• Conditions 
(M) mean 
(V) variance 
(O) Co-variance
Test(S): Conditions 
22 
The Standard Rate of (M) i (V) i and (O)i 
under which Test(S) is accepted. 
Total Passed / Trials (N-M+1) 
•(M) i 80% 
•(V) i 70% 
•(O) i 80% 
(continued)
Abnormality Test: $testABN 
$testABN(ts, term) 
>testABN_result <- testABN(diff(log(M2CD)), term=98) 
Time Series Length = 186 
Term = 98 
1 1 0 1 0 0 3 1 0 4 14 19 15 16 18 9 9 12 12 9 7 4 1 2 
1 1 1 4 4 3 2 1 3 4 8 16 12 11 5 6 7 5 5 3 3 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 2 6 35 103 84 81 
88 89 77 66 77 59 60 50 55 87 84 96 88 51 43 
• $TestABN uses log- and diff- transformed M2CD 
• term is the length of subsequence tested by test(S) .
Abnormality Test 
• Test the “degree of breaks in a time series” 
• Repeats Test(S) about subsequence TERM 
– The length of TERM is set to 98: Economical Data 
• $TestABN returns a sequence of the Test(S) results 
– Detect the points N -> 0 (N: natural number) 
24
Causality Test: $testCS 
$testCS(ts, term) 
>testCS_result<- testCS(M2CD, 100) 
>testCS_result$shc 
[1] NA NA NA NA 0.8317427 0.8493772 0.8471115 
[8] 0.8476854 0.8432251 0.8474183 0.8943973 0.8768367 0.8864003 0.8975523 
[15] 0.8943816 0.8876588 0.8841130 0.8554944 0.8761724 0.8838377 0.8857091 
[22] 0.8928515 0.8600705 0.8339162 0.8276518 0.8275824 0.8666339 0.8456843 
………………………………..(skipped) 
• testCS_result$shc[4,] expresses the Causality value of V3(n) 
• term is the length of subsequence
Causality Test: $testCS 
• Causality Test checks the linear causality relation 
from the time series X(n) to Y(n) 
• X: e.g. GDP 
• Y: e.g. M2CD 
• $TestCS returns a data frame of 19 arrays of CR-values 
CR(SH)i(y) 
26
Determinacy Test: $testD 
$testD(ts1, ts2, term) 
> testD_result<-testD(GDP, M2CD, 183) 
> testD_result$result[4,] 
[1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 
…………………………………………………(skip)……………………………… 
[162] 0.0000000 0.0000000 0.0000000 0.7482668 0.8520689 0.8561230 0.8512788 
[169] 0.8785611 0.8996980 0.9045383 0.8903662 0.8810984 0.8808611 0.8864593 
[176] 0.9035437 0.8871590 0.8862733 0.8848502 0.8751460 0.8882548 0.8878465 
[183] 0.8835506 0.8778081 
• The test(D) checks linear causality from M2CD to GDP in Japan 
( 1955q3 – 2001q4) 
• testD_result$result[4,] denotes the Determinacy value of V3(n)
Determinacy Test: $testD 
• LN(6,2) determinacy property 
- Time series Z(n) hold the property if D(Z) >= CR(SH) 
• $TestD returns java object TestD including 19 
determinacy function values as to V(n)k . 
Fields of java class TestD 
28 
$result 19 determinacy function values 
$index1,2 Index pair of (ψi(Z(f)), ψj(Z(f))
Visualization Example(1) 
$ts.plot, $abline 
> full_result <-append (rep(NA,term), testABN_result) # fitting length to original data 
> ts.plot(ts(full_result , 1955.5,,frequency=4),gpars=list(xlab="year",ylab="",yaxt = "n")) 
> abline(v=c(1981.25),lty = 3) 
• $abline depicts vertical lines at time points specified by “v=“
Visualization Example(2) 
$plotTestD(result, start) 
> plotTestD(testD_result, 4, 1955.5) 
> abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
Visualization Example(3) 
$plotSample(result, result, num, start) 
>plotSample(testCS_result$shc, testD_result, 4 ,1955.5) 
>abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
Advanced Visualization: ggplot2 
$ggplot2 
> abn<-read.table(file="plotABN.dat") 
>ggplot(abn , aes(x, y, fill=range)) + geom_area(alpha=0.3) 
+ ggtitle("Stationary Graph")+xlab("year")+ylab("M2CD")
Conclusion 
• This is a provisional version 
– TestD and TestCS requires further refinement 
– TestS and TestABN are almost stable 
– We try to elaborate Visualization skills 
• We hope these Tests will be commonly used. 
33
References 
1. Yuji Nakano, Yasunori Okabe : A Time Series Analysis of Economical 
Phenomena in Japan’s Lost Decade (1): Determinacy Property of the 
Velocity of Money and Equilibrium Solution ,Asia-Pacific Financial 
Markets November 2012, Volume 19, Issue 4, pp 371-389 
34

More Related Content

What's hot

R data mining-Time Series Analysis with R
R data mining-Time Series Analysis with RR data mining-Time Series Analysis with R
R data mining-Time Series Analysis with RDr. Volkan OBAN
 
Monadologie
MonadologieMonadologie
Monadologieleague
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2aravindangc
 
Limitless and recursion-free recursion limits!
Limitless and recursion-free recursion limits!Limitless and recursion-free recursion limits!
Limitless and recursion-free recursion limits!akaptur
 
Grokking Monads in Scala
Grokking Monads in ScalaGrokking Monads in Scala
Grokking Monads in ScalaTim Dalton
 
Rewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasRewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasAnatolii Kmetiuk
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavVyacheslav Arbuzov
 
Taking your side effects aside
Taking your side effects asideTaking your side effects aside
Taking your side effects aside💡 Tomasz Kogut
 
GradStudentSeminarSept30
GradStudentSeminarSept30GradStudentSeminarSept30
GradStudentSeminarSept30Ryan White
 
Home Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsHome Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsShaheen Sardar
 
How to extend map? Or why we need collections redesign? - Scalar 2017
How to extend map? Or why we need collections redesign? - Scalar 2017How to extend map? Or why we need collections redesign? - Scalar 2017
How to extend map? Or why we need collections redesign? - Scalar 2017Szymon Matejczyk
 
Playing Atari with Deep Reinforcement Learning
Playing Atari with Deep Reinforcement LearningPlaying Atari with Deep Reinforcement Learning
Playing Atari with Deep Reinforcement Learning郁凱 黃
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_PresentationAnna Lasota
 

What's hot (18)

R data mining-Time Series Analysis with R
R data mining-Time Series Analysis with RR data mining-Time Series Analysis with R
R data mining-Time Series Analysis with R
 
Big datacourse
Big datacourseBig datacourse
Big datacourse
 
Monadologie
MonadologieMonadologie
Monadologie
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Limitless and recursion-free recursion limits!
Limitless and recursion-free recursion limits!Limitless and recursion-free recursion limits!
Limitless and recursion-free recursion limits!
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Grokking Monads in Scala
Grokking Monads in ScalaGrokking Monads in Scala
Grokking Monads in Scala
 
Rewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasRewriting Engine for Process Algebras
Rewriting Engine for Process Algebras
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
 
Taking your side effects aside
Taking your side effects asideTaking your side effects aside
Taking your side effects aside
 
GradStudentSeminarSept30
GradStudentSeminarSept30GradStudentSeminarSept30
GradStudentSeminarSept30
 
Home Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsHome Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy Decisions
 
How to extend map? Or why we need collections redesign? - Scalar 2017
How to extend map? Or why we need collections redesign? - Scalar 2017How to extend map? Or why we need collections redesign? - Scalar 2017
How to extend map? Or why we need collections redesign? - Scalar 2017
 
Playing Atari with Deep Reinforcement Learning
Playing Atari with Deep Reinforcement LearningPlaying Atari with Deep Reinforcement Learning
Playing Atari with Deep Reinforcement Learning
 
2020 preTEST3A
2020 preTEST3A2020 preTEST3A
2020 preTEST3A
 
Week7
Week7Week7
Week7
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_Presentation
 
Dsprograms(2nd cse)
Dsprograms(2nd cse)Dsprograms(2nd cse)
Dsprograms(2nd cse)
 

Viewers also liked

Viewers also liked (7)

第4回
第4回第4回
第4回
 
Check list for documents at wog
Check list for documents at wogCheck list for documents at wog
Check list for documents at wog
 
all the truth about MILK
all the truth about MILKall the truth about MILK
all the truth about MILK
 
Test s
Test sTest s
Test s
 
第5回
第5回第5回
第5回
 
Test s velocity_15_5_4
Test s velocity_15_5_4Test s velocity_15_5_4
Test s velocity_15_5_4
 
Massa Is Kassa 2 Gea Boekuitgave Low Res
Massa Is Kassa 2   Gea Boekuitgave   Low ResMassa Is Kassa 2   Gea Boekuitgave   Low Res
Massa Is Kassa 2 Gea Boekuitgave Low Res
 

Similar to Test (S) on R

Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with RYanchang Zhao
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2Kevin Chun-Hsien Hsu
 
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」Ken'ichi Matsui
 
C++ Notes PPT.ppt
C++ Notes PPT.pptC++ Notes PPT.ppt
C++ Notes PPT.pptAlpha474815
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.pptSagarDR5
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..KarthikeyaLanka1
 
Lecture slides week14-15
Lecture slides week14-15Lecture slides week14-15
Lecture slides week14-15Shani729
 
Row patternmatching12ctech14
Row patternmatching12ctech14Row patternmatching12ctech14
Row patternmatching12ctech14stewashton
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming languageLincoln Hannah
 
Datamining r 4th
Datamining r 4thDatamining r 4th
Datamining r 4thsesejun
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Cdiscount
 
Time series data mining techniques
Time series data mining techniquesTime series data mining techniques
Time series data mining techniquesShanmukha S. Potti
 

Similar to Test (S) on R (20)

R
RR
R
 
R and data mining
R and data miningR and data mining
R and data mining
 
Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with R
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2
 
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」
第13回数学カフェ「素数!!」二次会 LT資料「乱数!!」
 
RBootcam Day 2
RBootcam Day 2RBootcam Day 2
RBootcam Day 2
 
R Programming Homework Help
R Programming Homework HelpR Programming Homework Help
R Programming Homework Help
 
C++ Notes PPT.ppt
C++ Notes PPT.pptC++ Notes PPT.ppt
C++ Notes PPT.ppt
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.ppt
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
R programming language
R programming languageR programming language
R programming language
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..
 
Lecture slides week14-15
Lecture slides week14-15Lecture slides week14-15
Lecture slides week14-15
 
Row patternmatching12ctech14
Row patternmatching12ctech14Row patternmatching12ctech14
Row patternmatching12ctech14
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
 
dld 01-introduction
dld 01-introductiondld 01-introduction
dld 01-introduction
 
Datamining r 4th
Datamining r 4thDatamining r 4th
Datamining r 4th
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)
 
Time series data mining techniques
Time series data mining techniquesTime series data mining techniques
Time series data mining techniques
 
Programming in R
Programming in RProgramming in R
Programming in R
 

Recently uploaded

Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...shivangimorya083
 
Instant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School SpiritInstant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School Spiritegoetzinger
 
The Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfThe Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfGale Pooley
 
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure serviceCall US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure servicePooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceanilsa9823
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designsegoetzinger
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfGale Pooley
 
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...Pooja Nehwal
 
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...Call Girls in Nagpur High Profile
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...ssifa0344
 
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130  Available With RoomVIP Kolkata Call Girl Serampore 👉 8250192130  Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Roomdivyansh0kumar0
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxanshikagoel52
 
Q3 2024 Earnings Conference Call and Webcast Slides
Q3 2024 Earnings Conference Call and Webcast SlidesQ3 2024 Earnings Conference Call and Webcast Slides
Q3 2024 Earnings Conference Call and Webcast SlidesMarketing847413
 
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home Delivery
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home DeliveryPooja 9892124323 : Call Girl in Juhu Escorts Service Free Home Delivery
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home DeliveryPooja Nehwal
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptxFinTech Belgium
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfGale Pooley
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfGale Pooley
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptxFinTech Belgium
 

Recently uploaded (20)

Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
 
Instant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School SpiritInstant Issue Debit Cards - High School Spirit
Instant Issue Debit Cards - High School Spirit
 
The Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfThe Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdf
 
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure serviceCall US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designs
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdf
 
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...
Independent Call Girl Number in Kurla Mumbai📲 Pooja Nehwal 9892124323 💞 Full ...
 
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
 
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130  Available With RoomVIP Kolkata Call Girl Serampore 👉 8250192130  Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptx
 
Q3 2024 Earnings Conference Call and Webcast Slides
Q3 2024 Earnings Conference Call and Webcast SlidesQ3 2024 Earnings Conference Call and Webcast Slides
Q3 2024 Earnings Conference Call and Webcast Slides
 
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home Delivery
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home DeliveryPooja 9892124323 : Call Girl in Juhu Escorts Service Free Home Delivery
Pooja 9892124323 : Call Girl in Juhu Escorts Service Free Home Delivery
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx
 
Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdf
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdf
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
 

Test (S) on R

  • 1. Try Test (S) on R Analyzing Time-Series Data 2014.9.3
  • 2. We introduce our R functions You should be able to: • Testify stationary of time series Z(n) • Identify fracture points of stationary time series Z(n) • Compute determinacy and causality values of Z1(n) and Z2(n) • Visualize the results using R plot functions • Apply these tests to various time series data 2
  • 3. Goals • Using Statistics Programing language R • Prototyping Each Test • Stationary Test: Test(S) • Abnormality Test: Test(ABN) • Determinacy Test: Test(D) • Causality Test: Test(ES) • Merits • Easy to handle • Apply the tests to various data • Spread the theory throughout the world
  • 4. History of Prototyping • These tests are developed as – Basic Programs By Prof • Test(S) , Test(ABN) 1988~ • Test(ES), Test(D) 2004~ – Java Programs (Converted from the Basic Programs) • Test(S) , Test(ABN) 2009 ~ Test(ES), Test(D) 2011 ~ • Java programs have high performance. However, require programming skills 4
  • 5. History: Prototyping Tests • Developed by – Basic Programs By • 1988 ~ – Java Programs By • 2009 ~ • R scripts + java class ( using Rjava ) By • 2012~ (continued) 5
  • 6. Merits using R 1. Usability: Easy to handle 2. Data processing Performance 3. Powerful Visualization 6
  • 8. 1 Easy to handle $testABN(ts, term) > testABN(M2CD, term=98) Time Series Length = 186 Term = 98 1 1 0 1 0 0 3 1 0 4 14 19 15 16 18 9 9 12 12 9 7 4 1 2 1 1 1 4 4 3 2 1 3 4 8 16 12 11 5 6 7 5 5 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 2 6 35 103 84 81 88 89 77 66 77 59 60 50 55 87 84 96 88 51 43 • M2CD denotes a money supply data in Japan (1955q3 – 2001q4) • Provided function $testABN calls Java class testS
  • 9. 1 Easy to handle $testD(ts1, ts2, term) (continued) > testD_result<-testD(GDP, M2CD, 183) > testD_result$result[4,] [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 …………………………………………………(skip)……………………………… [162] 0.0000000 0.0000000 0.0000000 0.7482668 0.8520689 0.8561230 0.8512788 [169] 0.8785611 0.8996980 0.9045383 0.8903662 0.8810984 0.8808611 0.8864593 [176] 0.9035437 0.8871590 0.8862733 0.8848502 0.8751460 0.8882548 0.8878465 [183] 0.8835506 0.8778081 • GDP denotes also Japan Nominal GDP data (1955q3 – 2001q4) • testD_result$result[4,] denotes the Determinacy value of V3(n)
  • 10. Data Accessing • testD_result is a data frame of matrix of R testD_result$result[4,] Row Access Column Access testD_result$result[4,] Dataframe_id$filed_id
  • 11. 2 Data processing Performance $scan, $log, $diff, $scale, $scale2 > M2CD <-scan("M2CD.DAT") • Input M2CD data file > M2CD_ld <- diff(log(M2CD)) Various data processing support: Log transformation, First difference and Standardization. M2CD_ld is used for test(ABN).
  • 12. 2 Data processing Performance $plot, $ts >M2CD <-scan("M2CD.DAT") >plot(ts(M2CD, start=1955.5,,frequency=4)) (continued)
  • 13. 2 Data processing Performance $plot, $ts, $log >plot(ts(log(M2CD), start=1955.5,,frequency=4)) (continued)
  • 14. 2 Data processing Performance $plot, $ts, $diff >plot(ts(diff(log(M2CD)), start=1955.5,,frequency=4)) (continued)
  • 15. 3 Visualization $plotTestD(result, start) > GDP <-scan("NGS-II.DAT") > M2CD <-scan("M2CD.DAT") >testD_result<-testD(GDP, M2CD, 183) >plotTestD(testD_result, 4, 1955.5) >abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
  • 17. Non linear transformation $NLtransform(ts) > NLtransform (diff(log(M2CD)) …………………..Return value………………………………….. • Test(S) and Test(ABN) uses non–linear transformation up to rank 6, which constructs 19 one-dimensional time series ψi(Z(f)) from Z(n). • $NLtransform returns 19 transformed time series as data frame.
  • 18. Stationary Test: $testS $testS(ts, term) > testS(diff(log(M2CD[1:99])), d=1) Dimension d= 1 Time Series Length = 99 Test(S) Passed [1] 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 Time Series [2], [3], [5], [7], [18] is passed by TEST(S) is passed and considered stationary. • $TestS is applied to a subsequence of log- and diff-transformed M2CD, whose data length is 99. ->M2CD[1:99]
  • 19. Stationary Test • Test the stationarity of the target time series – Repeats Test(S) about subsequence TERM – The length of TERM is set to 98: Economical Data • $TestS returns an array of test(S) results about 19 transformed time series ψi(Z(f)) – one dimension: 19 results of 1d-test(S) for ψi(Z(f)) – Two dimension: results of 2d-test(S) for (ψi(Z(f)), ψj(Z(f))) 19
  • 20. Test(S) : Preliminary • Time Series Data Z(m) – Sample mean vector μZ , – Sample covariance matrix function RZ 20
  • 21. Test(S): Conditions 21 • Three Test Values (M) (V) (O) • Conditions (M) mean (V) variance (O) Co-variance
  • 22. Test(S): Conditions 22 The Standard Rate of (M) i (V) i and (O)i under which Test(S) is accepted. Total Passed / Trials (N-M+1) •(M) i 80% •(V) i 70% •(O) i 80% (continued)
  • 23. Abnormality Test: $testABN $testABN(ts, term) >testABN_result <- testABN(diff(log(M2CD)), term=98) Time Series Length = 186 Term = 98 1 1 0 1 0 0 3 1 0 4 14 19 15 16 18 9 9 12 12 9 7 4 1 2 1 1 1 4 4 3 2 1 3 4 8 16 12 11 5 6 7 5 5 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 2 6 35 103 84 81 88 89 77 66 77 59 60 50 55 87 84 96 88 51 43 • $TestABN uses log- and diff- transformed M2CD • term is the length of subsequence tested by test(S) .
  • 24. Abnormality Test • Test the “degree of breaks in a time series” • Repeats Test(S) about subsequence TERM – The length of TERM is set to 98: Economical Data • $TestABN returns a sequence of the Test(S) results – Detect the points N -> 0 (N: natural number) 24
  • 25. Causality Test: $testCS $testCS(ts, term) >testCS_result<- testCS(M2CD, 100) >testCS_result$shc [1] NA NA NA NA 0.8317427 0.8493772 0.8471115 [8] 0.8476854 0.8432251 0.8474183 0.8943973 0.8768367 0.8864003 0.8975523 [15] 0.8943816 0.8876588 0.8841130 0.8554944 0.8761724 0.8838377 0.8857091 [22] 0.8928515 0.8600705 0.8339162 0.8276518 0.8275824 0.8666339 0.8456843 ………………………………..(skipped) • testCS_result$shc[4,] expresses the Causality value of V3(n) • term is the length of subsequence
  • 26. Causality Test: $testCS • Causality Test checks the linear causality relation from the time series X(n) to Y(n) • X: e.g. GDP • Y: e.g. M2CD • $TestCS returns a data frame of 19 arrays of CR-values CR(SH)i(y) 26
  • 27. Determinacy Test: $testD $testD(ts1, ts2, term) > testD_result<-testD(GDP, M2CD, 183) > testD_result$result[4,] [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 …………………………………………………(skip)……………………………… [162] 0.0000000 0.0000000 0.0000000 0.7482668 0.8520689 0.8561230 0.8512788 [169] 0.8785611 0.8996980 0.9045383 0.8903662 0.8810984 0.8808611 0.8864593 [176] 0.9035437 0.8871590 0.8862733 0.8848502 0.8751460 0.8882548 0.8878465 [183] 0.8835506 0.8778081 • The test(D) checks linear causality from M2CD to GDP in Japan ( 1955q3 – 2001q4) • testD_result$result[4,] denotes the Determinacy value of V3(n)
  • 28. Determinacy Test: $testD • LN(6,2) determinacy property - Time series Z(n) hold the property if D(Z) >= CR(SH) • $TestD returns java object TestD including 19 determinacy function values as to V(n)k . Fields of java class TestD 28 $result 19 determinacy function values $index1,2 Index pair of (ψi(Z(f)), ψj(Z(f))
  • 29. Visualization Example(1) $ts.plot, $abline > full_result <-append (rep(NA,term), testABN_result) # fitting length to original data > ts.plot(ts(full_result , 1955.5,,frequency=4),gpars=list(xlab="year",ylab="",yaxt = "n")) > abline(v=c(1981.25),lty = 3) • $abline depicts vertical lines at time points specified by “v=“
  • 30. Visualization Example(2) $plotTestD(result, start) > plotTestD(testD_result, 4, 1955.5) > abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
  • 31. Visualization Example(3) $plotSample(result, result, num, start) >plotSample(testCS_result$shc, testD_result, 4 ,1955.5) >abline(v=c(1981.25,1984,1996.5,1999),lty = 3)
  • 32. Advanced Visualization: ggplot2 $ggplot2 > abn<-read.table(file="plotABN.dat") >ggplot(abn , aes(x, y, fill=range)) + geom_area(alpha=0.3) + ggtitle("Stationary Graph")+xlab("year")+ylab("M2CD")
  • 33. Conclusion • This is a provisional version – TestD and TestCS requires further refinement – TestS and TestABN are almost stable – We try to elaborate Visualization skills • We hope these Tests will be commonly used. 33
  • 34. References 1. Yuji Nakano, Yasunori Okabe : A Time Series Analysis of Economical Phenomena in Japan’s Lost Decade (1): Determinacy Property of the Velocity of Money and Equilibrium Solution ,Asia-Pacific Financial Markets November 2012, Volume 19, Issue 4, pp 371-389 34