MatthieuStigler / tsDyn

tsDyn
tsdyn.googlecode.com
GNU General Public License v2.0
34 stars 20 forks source link

toLatex: intercept printed at wrong place #16

Open MatthieuStigler opened 4 years ago

MatthieuStigler commented 4 years ago

interecept shows after ECT, not before..

\documentclass{article}

\usepackage{amsmath}
\newenvironment{smatrix}{\begin{pmatrix}}{\end{pmatrix}} %USUAL

\begin{document}

<<>>=
library(tsDyn)
macro_model1  <- VECM(data=barry, lag=3, r = 2, include = "const", estim = "ML" )
toLatex(macro_model1)
coef(macro_model1)
coefA(macro_model1)
coefB(macro_model1)
coefPI(macro_model1)
coefA(macro_model1) %*%t(coefB(macro_model1))
@

<<results="asis">>=
toLatex(macro_model1)
@

\end{document}
library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
macro_model1  <- VECM(data=barry, lag=3, r = 2, include = "const", estim = "ML" )
toLatex(macro_model1)
#> %insert in the preamble and uncomment the line you want for usual /medium /small matrix
#> %\usepackage{amsmath} \newenvironment{smatrix}{\begin{pmatrix}}{\end{pmatrix}} %USUAL
#> %\usepackage{amsmath} \newenvironment{smatrix}{\left(\begin{smallmatrix}}{\end{smallmatrix}\right)} %SMALL
#> %\usepackage{nccmath} \newenvironment{smatrix}{\left(\begin{mmatrix}}{\end{mmatrix}\right)} %MEDIUM
#> \begin{equation}
#> \begin{smatrix} %explained vector
#> \Delta X_{t}^{1} \\ \Delta X_{t}^{2} \\ \Delta X_{t}^{3}
#> \end{smatrix}=
#> +\begin{smatrix}  %ECT
#> -0.0213 & 0.0006 \\
#> -0.0589 & 0.0019 \\
#> 0.1323 & -0.0026 
#> \end{smatrix}ECT_{-1}
#> \begin{smatrix}     %const
#> 0.0232 \\ 0.1917 \\ 0.1056
#> \end{smatrix}
#> +\begin{smatrix}      %Lag1
#> 0.1622 & -0.0034 & 0.0007 \\
#> 0.8620 & 0.4622 & -0.0486 \\
#> 0.6225 & 0.2660 & -0.0476 
#> \end{smatrix}
#> \begin{smatrix}
#> \Delta X_{t-1}^{1} \\ \Delta X_{t-1}^{2} \\ \Delta X_{t-1}^{3}
#> \end{smatrix}
#> +\begin{smatrix}      %Lag2
#> -0.0368 & 0.0011 & -0.0064 \\
#> -0.4883 & -0.0284 & 0.0738 \\
#> -0.1936 & 0.0042 & 0.1665 
#> \end{smatrix}
#> \begin{smatrix}
#> \Delta X_{t-2}^{1} \\ \Delta X_{t-2}^{2} \\ \Delta X_{t-2}^{3}
#> \end{smatrix}
#> +\begin{smatrix}      %Lag3
#> 0.0253 & -0.0036 & -0.0003 \\
#> -0.3894 & -0.0006 & 0.0944 \\
#> -0.6800 & 0.0141 & 0.1337 
#> \end{smatrix}
#> \begin{smatrix}
#> \Delta X_{t-3}^{1} \\ \Delta X_{t-3}^{2} \\ \Delta X_{t-3}^{3}
#> \end{smatrix}
#> \end{equation}

Created on 2020-02-19 by the reprex package (v0.3.0)