toLatexTable: Export a 'sigfit' object into paper-ready LaTeX table

Description Usage Arguments Details See Also Examples

View source: R/toLatex.sigfit.r

Description

This method converts one or more fitted models of class sigfit into a publication-ready LaTeX table. This conversion is performed by reformatting the models into a format that is fed to xtable, which generates the actual LaTeX code.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
toLatexTable(
  ...,
  se.list,
  stars = c("default", "all", "none"),
  caption = "",
  label,
  align,
  digits = 2,
  se.note = "Standard errors in parenthesis",
  order,
  covariate.labels,
  model.names,
  dep.varnames,
  k = 1,
  print.xtable.options = list()
)

Arguments

...

one or more models fit using sigint.

se.list

an optional list where each element contains the standard errors of the models. If included this list must include one element per model, even if that model's standard errors are unchanged. This argument should be used when standard errors have been adjusted outside the model (e.g., a bootstrap). If left empty the standard errors from the model's covariance matrix are used if available. Within each element of this list, the order of standard errors must be the same order as the coefficients in the model. Standard errors are not matched on name.

stars

how should significance stars be used? stars = "default" returns a single star when p < 0.05, stars = "all" returns flags for p < 0.1, p < 0.05, and p < 0.01, and stars = "none" returns no stars at all.

caption

a string to be used as the table's caption.

label

a string to be used as the table's LaTeX label argument.

align

a string to indicate the alignment of each column in the table. Passed directly to the LaTeX tabular options.

digits

how many digits after the decimal point should be displayed? Default 2.

se.note

a string containing a note for the bottom of the table. Default is the common "Standard errors in parenthesis.

order

a string vector describing the order that the covariates should be in the table. The default is to use the order they're listed in the sigfit object. When this vector is shorter than the coefficient vector, variables are first included by order, remaining variables are included based on their order in the model

covariate.labels

a string vector of "nice" names for the variables appropriate for a published work. If empty, the "ugly" names from the fitted model are used. Note that if order is specified then the covariate labels must match the order in order.

model.names

an optional vector of model names to include as column titles in the table. Should be either a single title or one title per model (repetition is allowed). If only one title is given, that is centered over the table.

dep.varnames

an optional vector to describe the dependent variable in the models. Can be either a single variable name or one per model (repetition is allowed).

k

an integer to start the counter for model numbers in the table.

print.xtable.options

a list of options for print.xtable.

Details

This function produces a ready-to-use LaTeX table for sigfit objects. Each column is its own model, along with model-based information. The generation of LaTeX code is done by xtable and so additional printing options can be passed via print.xtable.options. For a full list of these options see print.xtable.

See Also

xtable, print.xtable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
data("sanctionsData")
f1 <- sq+cd+sf+bd ~ sqrt(senderecondep) + senderdemocracy + contig + ally -1|#SA
                    anticipatedsendercosts|#VA
                    sqrt(targetecondep) + anticipatedtargetcosts + contig + ally|#CB
                    sqrt(senderecondep) + senderdemocracy + lncaprat | #barWA
                    targetdemocracy + lncaprat| #barWB
                    senderdemocracy| #bara
                    -1#VB
## Using Nested-Pseudo Likelihood  with default first stage
## Not run: 
fit1 <- sigint(f1, data=sanctionsData, npl.trace=TRUE)

## End(Not run)

## Using Pseudo Likelihood with user made first stage
Phat <- list(PRhat=sanctionsData$PRhat, PFhat=sanctionsData$PFhat)
fit2 <- sigint(f1, data=sanctionsData, method="pl", phat=Phat)

## Using Pseudo Likelihood with default first stage and bootstrapped standard errors
## Not run: 
fit3 <- sigint(f1, data=sanctionsData, method="pl", pl.vcov=25) 

## End(Not run)

## Simple regression table
toLatexTable(fit2)

## More options: multiple models and user supplied standard errors
## Not run: 
toLatexTable(fit1, fit2, fit3,
        se.list=list(sqrt(diag(vcov(fit1))),
                     sqrt(diag(vcov(fit3))),
                     sqrt(diag(vcov(fit3)))),
        stars="all",
        caption = "Economic Sanctions",
        label = "tab:sanctions",
        model.names = c("NPL", "PL", "PL"))

## End(Not run)         
        
## Not run: 
## More options, from print.xtable including printing to a file
toLatexTable(fit1, fit2, fit3,
        caption = "Economic Sanctions",
        label = "tab:sanctions",
        model.names = c("NPL", "PL", "PL"),
        print.xtable.options=list(file="myTable.tex",
                                  booktabs=TRUE))

## End(Not run)

sigInt documentation built on Jan. 11, 2020, 9:20 a.m.

Related to toLatexTable in sigInt...