2

I'm impressed with the reported functionality of stargazer because it boasts flexibility with multiple model types. However, I can't seem to use stargazer to get latex table output with generalized additive models, even though the documentation states that it handle gam object types. Here's a MWE.

require(stargazer)
require(mgcv)

dat <- gamSim(1,n=400,dist="normal",scale=2)
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
stargazer(b)

Here's the output specifying the error.

% Table created by StarGazer v.2.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Fri, Feb 08, 2013 - 10:29:39 AM
\begin{table}[htb] \centering 
  \caption{} 
\footnotesize 

\begin{tabular}{@{\extracolsep{5pt}}lc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
\cline{2-2} 
\\[-1.8ex] & y \\ 
\cline{2-2} 
\\[-1.8ex] & \textit{GAM} \\ 
 & \textit{(continuous)} \\ 
\hline \\[-1.8ex] 
 s(x0).1Error: subscript out of bounds

I've tried this using different gam models and I get the same error. Has anyone had any luck creating latex tables using stargazer and gam? Am I missing something here or is this a bug?

Specs: R 2.14.2, just updated relevant packages.

fawda123
  • 479
  • 3
  • 12
  • 4
    I tried running your example, using the latest stargazer 3.0.1 (although that should make no difference). I did not encounter any error. If you keep experiencing this error, however, please e-mail the package's author with details, so that the issue can be fixed in a future release. –  Feb 08 '13 at 17:07
  • 1
    Note that smooths' summaries are difficult to display with stargazer: see post [here](https://stackoverflow.com/questions/17104737/stargazer-and-gam-how-to-include-the-whole-summary-output). – Kim Aug 09 '19 at 09:01

0 Answers0