Generate LaTeX code of an estimation result
printtex.RdConvenience functions that generates LaTeX-code of an estimation result in equation-form. printtex can, in principle, be applied to any object for which coef, vcov and logLik methods exist. Note: The generated LaTeX-code contains an eqnarray environment, which requires that the amsmath package is loaded in the preamble of the LaTeX document.
Arguments
- x
an estimation result, e.g.
arx,getsorisatobject- object
an estimation result of class
arxorgets- fitted.name
NULLor a user-specified name of left-hand side variable- xreg.names
NULLor a user-specified character vector with the names of regressors- digits
integer, the number of digits to be printed
- intercept
logical or numeric. The argument determines whether one of the regressors is an intercept or not, or its location. If
TRUE, then the intercept is assumed to be located atcoef(x)[1], and hence the regressor-name of location 1 is excluded from the print. IfFALSE, then it is assumed that there is no intercept among the regressors. If numeric, then it is assumed that the regressors contain an intercept at the location equal to the numeric value- gof
logical, whether to include goodness-of-fit in the print
- diagnostics
logical, whether to include diagnostics in the print
- nonumber
logical, whether to remove or not (default) the equation-numbering
- nobs
character, the notation to use to denote the number of observations
- index
NULLor acharacter, only relevant iffitted.nameis notNULL, and if the object in question is of classarx,getsorisat- dec
NULLor acharacter(for example","). In the latter case, an attempt is made to replace the dot separator.with the character indec- print.info
logical, whether to print the info at the start or not- ...
arguments passed on to
printtex
Author
Genaro Sucarrat, http://www.sucarrat.net/
Examples
##simulate random variates, estimate model:
y <- rnorm(30)
mX <- matrix(rnorm(30*2), 30, 2)
mymod <- arx(y, ar=1:3, mxreg=mX)
##print latex code of estimation result:
printtex(mymod)
#> % Date: Mon Apr 7 09:08:32 2025
#> % LaTeX code generated in R 4.4.3 by the gets package
#> % Note: The {eqnarray} environment requires the {amsmath} package
#> \begin{eqnarray}
#> \widehat{y} &=& - \underset{(0.2278)}{0.0943} + \underset{(0.2377)}{0.3050}ar1 + \underset{(0.2320)}{0.0541}ar2 - \underset{(0.2389)}{0.0103}ar3 - \underset{(0.2714)}{0.2830}mxreg1 - \underset{(0.2562)}{0.1437}mxreg2 \\[2mm]
#> && R^2=0.1300 \qquad \widehat{\sigma}=1.1209 \qquad LogL=-38.3939 \qquad T = 27 \nonumber \\
#> && \underset{[p-val]}{ AR(4) }: \underset{[0.7966]}{1.6678}\qquad \underset{[p-val]}{ ARCH(1)}:\underset{[0.1313]}{2.2771}\qquad \underset{[p-val]}{ Normality }:\underset{[0.7758]}{0.5078} \nonumber
#> \end{eqnarray}
##add intercept, at the end, to regressor matrix:
mX <- cbind(mX,1)
colnames(mX) <- c("xreg1", "xreg2", "intercept")
mymod <- arx(y, mc=FALSE, mxreg=mX)
##set intercept location to 3:
printtex(mymod, intercept=3)
#> % Date: Mon Apr 7 09:08:32 2025
#> % LaTeX code generated in R 4.4.3 by the gets package
#> % Note: The {eqnarray} environment requires the {amsmath} package
#> \begin{eqnarray}
#> \widehat{y} &=& - \underset{(0.2374)}{0.2241}xreg1 - \underset{(0.2024)}{0.1291}xreg2 - \underset{(0.1972)}{0.1021} \\[2mm]
#> && R^2=0.0350 \qquad \widehat{\sigma}=1.0692 \qquad LogL=-43.0759 \qquad T = 30 \nonumber \\
#> && \underset{[p-val]}{ AR(1) }: \underset{[0.1043]}{2.6383}\qquad \underset{[p-val]}{ ARCH(1)}:\underset{[0.1111]}{2.5388}\qquad \underset{[p-val]}{ Normality }:\underset{[0.6428]}{0.8839} \nonumber
#> \end{eqnarray}