TVAR estimation. code

773 views
Skip to first unread message

lpn...@gmail.com

unread,
Aug 2, 2014, 7:21:45 AM8/2/14
to ts...@googlegroups.com
Dear all,
I want to understand TVAR code in tsDyn_0.9-33.tar.gz.
I run step by step TVAR .estimation code , but R progam noticed some errors so don't complete.
Hope You share exactly TVAR .estimation code, and help me about it.
I would be grateful for any help. 
Best regard,
Nguyen Luu.
Ps: I attch file word, highlight indicate first errors.
Multivariate Threshold Autoregressive model.doc

Matthieu

unread,
Aug 5, 2014, 12:08:09 PM8/5/14
to ts...@googlegroups.com, lpn...@gmail.com
Dear Luu

Thanks for sending the code, but this is the source code of the package, to which everyone has access. You can view it downlooding the source from cran, or on the github repository listed below.

It is difficult to answer your question without mention of what kind of errors you encounter, and without reproducible example. Try using the latest development version in case, and let us know if the problem still happens:

library(devtools)
install_github("tsDyn", ref="Dev94", username="MatthieuStigler", subdir="tsDyn")        

Best

Matthieu

Le 02. 08. 14 13:21, lpn...@gmail.com a écrit :
--
You received this message because you are subscribed to the Google Groups "tsdyn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tsdyn+un...@googlegroups.com.
To post to this group, send email to ts...@googlegroups.com.
Visit this group at http://groups.google.com/group/tsdyn.
For more options, visit https://groups.google.com/d/optout.

Nguyên Lưu

unread,
Aug 6, 2014, 3:20:05 AM8/6/14
to ts...@googlegroups.com

Dear Matthieu Stigler,
 I really thank for your help. Hope that You care and answer my questions.
 I installed successful devtools and unsuccessfull in install_github("tsDyn", ref="Dev94", username="MatthieuStigler", subdir="tsDyn") with the notices as:
   [ " Installing github repo tsDyn/Dev94 from MatthieuStigler
   Downloading Dev94.zip from https://github.com/MatthieuStigler/tsDyn/archive/Dev94.zip
   Installing package from C:\Users\ADMINI~1\AppData\Local\Temp\RtmpGevece/Dev94.zip
   Installing tsDyn
   "C:/PROGRA~1/R/R-31~1.1/bin/x64/R" --vanilla CMD build  \
   "C:\Users\Administrator\AppData\Local\Temp\RtmpGevece\devtoolscec30fd247d\tsDyn-Dev94\tsDyn"  \
   --no-manual --no-resave-data

   * checking for file 'C:\Users\Administrator\AppData\Local\Temp\RtmpGevece\devtoolscec30fd247d\tsDyn-Dev94\tsDyn/DESCRIPTION' ... OK
   * preparing 'tsDyn':
   * checking DESCRIPTION meta-information ... OK
   * cleaning src
   * installing the package to build vignettes
     Warning: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/Rcmd.exe" INSTALL -l "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpSipicT\Rinstad8200d77e5" --no-multiarch "C:/Users/Administrator/AppData/Local/Temp/RtmpSipicT/Rbuildad840291a7a/tsDyn"' had status 1
      -----------------------------------
* installing *source* package 'tsDyn' ...
** libs
Warning: running command 'make -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB="tsDyn.dll" WIN=64 TCLBIN=64 OBJECTS="llar.o misc.o search.o"' had status 127
ERROR: compilation failed for package 'tsDyn'
* removing 'C:/Users/ADMINI~1/AppData/Local/Temp/RtmpSipicT/Rinstad8200d77e5/tsDyn'

      -----------------------------------
ERROR: package installation failed
Error: Command failed (1)

   ----------------------------------- " ]
I don't know available reasons, how to install it successfully. At this time, I use version Rx64 3.1.1 with tsDyn.9.33.
I want to understand the ideas of you in TVAR code( include: estimate, TVAR.boot, TVAR.LRtest, TVAR.sim) as: progressions and meaningful results, then I can explain to my teacher ,classmate about TVAR, apply TVAR in my essay.
I copy your code from parkages tsDyn version 9.33 and Dev9.4(from https://github.com/MatthieuStigler/tsDyn/blob/fd29af5b8ac584743a7330cd8128e8db5fd5e849/tsDyn/R/TVARestim.R) to R-editor.In the code,  I proceed as below :
- Change data with my data.
- Run R step by step( Run line or selection in R), then use command "View(object)" to see note object results.
- Finally, with the results in steps with code paragraphs, think to understand your TVAR.
- Are Thereshold results depended on" ngrid, trim,gamma, gam1 and gam2,mTh,nthreshold,thDelay...else?"(with initial value of gam1 and gam2, where in code to run in case one threshold?)?

-Are the differences between version 9.33 and Dev9.4 tsDyn are "lm.fit" replace "B1, res" in calculating them? what elses?

Very happy in understanding them and thank for Your useful work and help. Hope you guide and share your ideas in the codes for me.
I look forward to guides from your answers.
Best regard,
Nguyên Lưu.
Ps: I attach file result from running my example. I copy and paste to Word.



My example.doc
TVAR.MLB2.txt

Matthieu

unread,
Aug 12, 2014, 8:36:48 AM8/12/14
to ts...@googlegroups.com, lpn...@gmail.com
Dear Luu

Oh, I am sorry you are not able to compile properly the Dev version. As you seem to be using Windows, I cannot help to solve this. But I just submitted a new version to CRAN (to be announced very soon), so you should be able to have the latest version with the normal mechanisms in a few hours/days.

Actually, the problem you are encountering is not specific to tsDyn, but to R. You need to learn how to inspect in R a function, get the difference between global and local variable, as well as with function environments... There are plenty of explanations on the web, I hope you will find answers there. Look especially at the environment() function

To answer the tsdyn specific question, yes, the threshold results depend on on the choice of the arguments in TVAR, basically almost all of them will influence the result.

Also, please avoid sending word documents, for many reasons, one of them being that Word is not even available on the platform I use, Linux.

Best regards

Matthieu


Le 06. 08. 14 09:20, Nguyên Lưu a écrit :

Nguyên Lưu

unread,
Aug 23, 2014, 4:51:12 AM8/23/14
to ts...@googlegroups.com
Dear Matthieu Stigler,
Thanks for your guide . At this time, I understood your ideas in TVAR code. Really, it's interested in me.
I think that TVAR code is applied in studying with some problems as below:
- Threshold value is one of the values of  Threshold variable in model, but whether it can been a random value by the value of  initial threshold variable with the random process, this is available in the life?
- Condition in identifying threshold value is SSR min, replace by log(det(cov (residual)))?
- About GIRF, I believe that you can do it well. I'm afraid that you don't have time for its.
Hope that you answer about two questions to help me.
Thanks you very much.
Best regard,
Phuc Nguyen Luu.

Matthieu

unread,
Aug 25, 2014, 6:52:14 AM8/25/14
to ts...@googlegroups.com, lpn...@gmail.com
Dear Phuc

I must say I have some difficulties to understand exactly what you mean, hope to answer to your points:
- yes, the function is estimating for observed thresholds values, and not for other random ones.  Note that if th_{o} and th_{o+1} represent the ordered threshold values, the indicator function I(thVar <= x) will give the same value for all x such that th_{o} < x <= th{o+1} for a discretely observed thVar, so just computing for th{o+1} is enough
-mmh, need to think about this indeed. Could use det(cov(res)) indeed, not sure though log() is necessary, as it is a monotonic transformation...

Best

Matthieu


Le 23. 08. 14 10:51, Nguyên Lưu a écrit :

Nguyên Lưu

unread,
Aug 25, 2014, 10:50:41 PM8/25/14
to ts...@googlegroups.com
Dear Matthieu Stigler ,
Thanks for your help to me. For a long time, you have helped me to understand about TVAR code.
I understood about it, hope that it is right with your ideas. I have started my essay with TVAR model.
Thanks for your useful work!
Best Regard,
Nguyen Luu


Reply all
Reply to author
Forward
0 new messages