Skip to contents

Convenience 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.

Usage

printtex(x, fitted.name=NULL, xreg.names=NULL, digits=4,
      intercept=TRUE, gof=TRUE, diagnostics=TRUE, nonumber=FALSE,
      nobs="T", index="t", dec=NULL, print.info=TRUE)
  # S3 method for class 'arx'
toLatex(object, ...)
  # S3 method for class 'gets'
toLatex(object, ...)

Arguments

x

an estimation result, e.g. arx, gets or isat object

object

an estimation result of class arx or gets

fitted.name

NULL or a user-specified name of left-hand side variable

xreg.names

NULL or 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 at coef(x)[1], and hence the regressor-name of location 1 is excluded from the print. If FALSE, 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

NULL or a character, only relevant if fitted.name is not NULL, and if the object in question is of class arx, gets or isat

dec

NULL or a character (for example ","). In the latter case, an attempt is made to replace the dot separator . with the character in dec

print.info

logical, whether to print the info at the start or not

...

arguments passed on to printtex

Details

toLatex.arx and toLatex.gets are simply wrappers to printtex

Value

LaTeX code of an estimation result

Author

Genaro Sucarrat, http://www.sucarrat.net/

See also

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: Sat Jul 27 15:30:05 2024 
#> % LaTeX code generated in R 4.4.1 by the gets package
#> % Note: The {eqnarray} environment requires the {amsmath} package
#> \begin{eqnarray}
#>   \widehat{y} &=&  - \underset{(0.1481)}{0.0258} - \underset{(0.1921)}{0.3498}ar1 - \underset{(0.2189)}{0.7896}ar2 - \underset{(0.2335)}{0.4599}ar3 - \underset{(0.1910)}{0.0491}mxreg1 - \underset{(0.2108)}{0.4876}mxreg2 \\[2mm] 
#>    && R^2=0.4176 \qquad \widehat{\sigma}=0.7655 \qquad LogL=-28.0945 \qquad T = 27 \nonumber \\ 
#>    && \underset{[p-val]}{ AR(4) }: \underset{[0.8518]}{1.3561}\qquad \underset{[p-val]}{ ARCH(1)}:\underset{[0.2764]}{1.1848}\qquad \underset{[p-val]}{ Normality }:\underset{[0.5921]}{1.0480} \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: Sat Jul 27 15:30:05 2024 
#> % LaTeX code generated in R 4.4.1 by the gets package
#> % Note: The {eqnarray} environment requires the {amsmath} package
#> \begin{eqnarray}
#>   \widehat{y} &=& \underset{(0.1903)}{0.0886}xreg1 - \underset{(0.1957)}{0.1390}xreg2 + \underset{(0.1616)}{0.0175} \\[2mm] 
#>    && R^2=0.0197 \qquad \widehat{\sigma}=0.8850 \qquad LogL=-37.4045 \qquad T = 30 \nonumber \\ 
#>    && \underset{[p-val]}{ AR(1) }: \underset{[0.5953]}{0.2821}\qquad \underset{[p-val]}{ ARCH(1)}:\underset{[0.8678]}{0.0277}\qquad \underset{[p-val]}{ Normality }:\underset{[0.4308]}{1.6842} \nonumber 
#> \end{eqnarray}