[R-SIG-Finance] Replicating TVECM plot

Eric Berger er|cjberger @end|ng |rom gm@||@com
Thu Aug 1 17:17:53 CEST 2019


Hi Rodrigo,
I have no experience with this particular package but I took a quick look.
a) I was able to find the information in the tvec object for the final
Residual Sum of Squares (i.e. for the "optimal" choice).
    More precisely the individual residuals are available in an Nx2 matrix,
call it M, and by calculating t(M) %*% M you get a 2x2 matrix
    and the sum of its diagonals is the Residual Sum of Squares at the
final stage in the search.
b) it looks to me like the tvec object does *not* contain the information
in the plot (I could certainly be wrong).
    This would not be that surprising as there is no obvious necessity for
reporting what are essentially "intermediate" results on the way to the
final answer.

If you really want to reproduce the plot, a couple of options you might
consider:
i. go into the source code and find where the plot is generated and  modify
the code to print out the data that you want
ii. contact the author(s) of the package directly with your question. Maybe
the data is in the returned object. Or maybe they can make an enhancement
to include it in the returned object.

Best,
Eric


On Wed, Jul 31, 2019 at 6:36 PM Rodrigo Badilla <rodrigo.badilla using gmail.com>
wrote:

> Hi all,
>
> I am working with a TVECM model using library tsDyn.
>
> I am trying to get data (Residual Sum of squares)  from a TVECM model, the
> result give me a plot that I would like replicate with ggplot. I had check
> all results but none coincide with plot data, example:
>
> library(tsDyn)
> data(zeroyld)
>
> #runing this command you get the plot that I need replicate:
>
>
> tvec <- TVECM(zeroyld, nthresh=2,lag=1, ngridBeta=20, ngridTh=30,
> plot=TRUE,trim=0.05, common="All")
>
>
> #I did check all this results but none help me to replicate the graph
> names(tvec)
>
>
> [1] "coefficients"   "residuals"      "model"          "coeffmat"
>  [5] "nobs_regimes"   "k"              "t"              "T"
>  [9] "nparB"          "fitted.values"  "lag"            "include"
> [13] "model.specific"
>
> Do you now how get Residual Sum of squares to replicate this graph?
>
> Any comments I will grateful
> Regards
> Rodrigo
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list