Skip to contents

This function is deprecated. Instead, please use outreg(type = "html")

Usage

outreg2HTML(outreg, filename)

Arguments

outreg

output from outreg

filename

A file name into which the regression markup is to be saved. Should end in .html.

Value

A vector of strings

Details

This will write the html on the screen, but if a filename argument is supplied, it will write a file. One can then open or insert the file into Libre Office or other popular "word processor" programs.

Author

Paul E. Johnson pauljohn@ku.edu

Examples

dat <- genCorrelatedData2(means = c(50,50,50,50,50,50),
    sds = c(10,10,10,10,10,10), rho = 0.2, beta = rnorm(7), stde = 50)
#> [1] "The equation that was calculated was"
#> y = 0.1700512 + 0.698106162851769*x1 + -1.31746411123807*x2 + 0.336734754149924*x3 + -0.566377227766106*x4 + 0.210669422412191*x5 + 0.909036647675649*x6 
#>  + 0*x1*x1 + 0*x2*x1 + 0*x3*x1 + 0*x4*x1 + 0*x5*x1 + 0*x6*x1 
#>  + 0*x1*x2 + 0*x2*x2 + 0*x3*x2 + 0*x4*x2 + 0*x5*x2 + 0*x6*x2 
#>  + 0*x1*x3 + 0*x2*x3 + 0*x3*x3 + 0*x4*x3 + 0*x5*x3 + 0*x6*x3 
#>  + 0*x1*x4 + 0*x2*x4 + 0*x3*x4 + 0*x4*x4 + 0*x5*x4 + 0*x6*x4 
#>  + 0*x1*x5 + 0*x2*x5 + 0*x3*x5 + 0*x4*x5 + 0*x5*x5 + 0*x6*x5 
#>  + 0*x1*x6 + 0*x2*x6 + 0*x3*x6 + 0*x4*x6 + 0*x5*x6 + 0*x6*x6 
#>  + N(0,50) random error 
m1 <- lm(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x1*x2, data = dat)
summary(m1)
#> 
#> Call:
#> lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x1 * x2, data = dat)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -114.373  -34.081   -5.618   37.459  136.442 
#> 
#> Coefficients:
#>               Estimate Std. Error t value Pr(>|t|)  
#> (Intercept) -150.84458  163.96711  -0.920   0.3600  
#> x1             3.56052    3.15428   1.129   0.2619  
#> x2             2.16538    3.46545   0.625   0.5336  
#> x3             0.49006    0.50651   0.968   0.3358  
#> x4            -0.72974    0.45666  -1.598   0.1135  
#> x5             0.16985    0.53253   0.319   0.7505  
#> x6             1.02774    0.60891   1.688   0.0948 .
#> x1:x2         -0.06328    0.06543  -0.967   0.3360  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 50.57 on 92 degrees of freedom
#> Multiple R-squared:  0.1381,	Adjusted R-squared:  0.07247 
#> F-statistic: 2.105 on 7 and 92 DF,  p-value: 0.05062
#> 

m1out <- outreg(list("Great Regression" = m1), alpha = c(0.05, 0.01, 0.001),
         request = c("fstatistic" = "F"), runFuns = c(AIC = "AIC"),
         float = TRUE)
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#>  \begin{tabular}{@{}l*{2}{l}@{}}
#> \hline
#>   &\multicolumn{1}{l}{Great Regression  }\tabularnewline
#>  &\multicolumn{1}{l}{Estimate}\tabularnewline
#>  &\multicolumn{1}{l}{(S.E.)}\tabularnewline
#>  \hline
#>  \hline
#>   (Intercept) & -150.845 \tabularnewline
#>  &(163.967)\tabularnewline
#>   x1 & 3.561 \tabularnewline
#>  &(  3.154)\tabularnewline
#>   x2 & 2.165 \tabularnewline
#>  &(  3.465)\tabularnewline
#>   x3 & 0.490 \tabularnewline
#>  &(  0.507)\tabularnewline
#>   x4 & -0.730 \tabularnewline
#>  &(  0.457)\tabularnewline
#>   x5 & 0.170 \tabularnewline
#>  &(  0.533)\tabularnewline
#>   x6 & 1.028 \tabularnewline
#>  &(  0.609)\tabularnewline
#>   x1:x2 & -0.063 \tabularnewline
#>  &(  0.065)\tabularnewline
#>  \hline
#>  N&\multicolumn{1}{l}{100} \tabularnewline
#>  RMSE&50.572\tabularnewline
#>  $R^2$&0.138\tabularnewline
#>  adj $R^2$&0.072\tabularnewline
#>  F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{2.11(7,92)}\tabularnewline
#>  AIC&\multicolumn{1}{c}{1078.13}\tabularnewline
#>  \hline
#> \hline
#>  
#>  \multicolumn{2}{l}{  ${*  p}\le 0.05$${*\!\!*  p}\le 0.01$${*\!\!*\!\!*  p}\le 0.001$}\tabularnewline
#>  \end{tabular}
#>  \end{table}
#> 
##html markup will appear on screen
outreg2HTML(m1out)
#> <tr><td>\begin{table
#> \caption{A Regression\label{regrlabl
#>  <table>
#>  <tr><td> </td><td colspan = '1'> Great Regression  \tabularnewline
#>  <tr><td></td><td colspan = '1'> Estimate\tabularnewline
#>  <tr><td></td><td colspan = '1'> (S.E.)\tabularnewline
#>    <tr><td> (Intercept) </td><td> -150.845 \tabularnewline
#>  <tr><td></td><td>(163.967)\tabularnewline
#>  <tr><td> x1 </td><td> 3.561 \tabularnewline
#>  <tr><td></td><td>(  3.154)\tabularnewline
#>  <tr><td> x2 </td><td> 2.165 \tabularnewline
#>  <tr><td></td><td>(  3.465)\tabularnewline
#>  <tr><td> x3 </td><td> 0.490 \tabularnewline
#>  <tr><td></td><td>(  0.507)\tabularnewline
#>  <tr><td> x4 </td><td> -0.730 \tabularnewline
#>  <tr><td></td><td>(  0.457)\tabularnewline
#>  <tr><td> x5 </td><td> 0.170 \tabularnewline
#>  <tr><td></td><td>(  0.533)\tabularnewline
#>  <tr><td> x6 </td><td> 1.028 \tabularnewline
#>  <tr><td></td><td>(  0.609)\tabularnewline
#>  <tr><td> x1:x2 </td><td> -0.063 \tabularnewline
#>  <tr><td></td><td>(  0.065)\tabularnewline
#>   <tr><td>N</td><td colspan = '1'> 100 \tabularnewline
#>  <tr><td>RMSE</td><td>50.572\tabularnewline
#>  <tr><td>R<sup>2</sup></td><td>0.138\tabularnewline
#>  <tr><td>adj R<sup>2</sup></td><td>0.072\tabularnewline
#>  <tr><td>F( df_{num , df_{denom )</td><td colspan = '1'> 2.11(7,92)\tabularnewline
#>  <tr><td>AIC</td><td colspan = '1'> 1078.13\tabularnewline
#>   <tr><td></tr></td>
#>  <tr><td colspan = '3'>*  p&#8804; 0.05 *\!\!*  p&#8804; 0.01 *\!\!*\!\!*  p&#8804; 0.001 \tabularnewline
#>  </table>
#>  <tr><td>\end{table
#> 
## outreg2HTML(m1out, filename = "funky.html")
## I'm not running that for you because you
## need to be in the intended working directory

m2 <- lm(y ~ x1 + x2, data = dat)

m2out <- outreg(list("Great Regression" = m1, "Small Regression" = m2),
               alpha = c(0.05, 0.01, 0.01),
                request = c("fstatistic" = "F"), runFuns = c(BIC = "BIC"))
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#>   &\multicolumn{1}{l}{Great Regression  } &\multicolumn{1}{l}{Small Regression  }\tabularnewline
#>  &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#>  &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#>  \hline
#>  \hline
#>   (Intercept) & -150.845 & 30.068 \tabularnewline
#>  &(163.967)&(36.741)\tabularnewline
#>   x1 & 3.561 & 0.773 \tabularnewline
#>  &(  3.154)&( 0.502)\tabularnewline
#>   x2 & 2.165 & -0.887 \tabularnewline
#>  &(  3.465)&( 0.568)\tabularnewline
#>   x3 & 0.490 &\multicolumn{1}{l}{\_ }\tabularnewline
#>  &(  0.507) &\tabularnewline
#>   x4 & -0.730 &\multicolumn{1}{l}{\_ }\tabularnewline
#>  &(  0.457) &\tabularnewline
#>   x5 & 0.170 &\multicolumn{1}{l}{\_ }\tabularnewline
#>  &(  0.533) &\tabularnewline
#>   x6 & 1.028 &\multicolumn{1}{l}{\_ }\tabularnewline
#>  &(  0.609) &\tabularnewline
#>   x1:x2 & -0.063 &\multicolumn{1}{l}{\_ }\tabularnewline
#>  &(  0.065) &\tabularnewline
#>  \hline
#>  N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#>  RMSE&50.572 &51.886\tabularnewline
#>  $R^2$&0.138 &0.043\tabularnewline
#>  adj $R^2$&0.072 &0.024\tabularnewline
#>  F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{2.11(7,92)} &\multicolumn{1}{c}{2.2(2,97)}\tabularnewline
#>  BIC&\multicolumn{1}{c}{1101.58} &\multicolumn{1}{c}{1088.97}\tabularnewline
#>  \hline
#> \hline
#>  
#>  \multicolumn{3}{l}{  ${*  p}\le 0.05$${*\!\!*  p}\le 0.01$${*\!\!*\!\!*  p}\le 0.01$}\tabularnewline
#>  \end{tabular}
outreg2HTML(m2out)
#> <table>
#>  <tr><td> </td><td colspan = '1'> Great Regression   </td><td colspan = '1'> Small Regression  \tabularnewline
#>  <tr><td></td><td colspan = '1'> Estimate</td><td colspan = '1'> Estimate\tabularnewline
#>  <tr><td></td><td colspan = '1'> (S.E.)</td><td colspan = '1'> (S.E.)\tabularnewline
#>    <tr><td> (Intercept) </td><td> -150.845 </td><td> 30.068 \tabularnewline
#>  <tr><td></td><td>(163.967)</td><td>(36.741)\tabularnewline
#>  <tr><td> x1 </td><td> 3.561 </td><td> 0.773 \tabularnewline
#>  <tr><td></td><td>(  3.154)</td><td>( 0.502)\tabularnewline
#>  <tr><td> x2 </td><td> 2.165 </td><td> -0.887 \tabularnewline
#>  <tr><td></td><td>(  3.465)</td><td>( 0.568)\tabularnewline
#>  <tr><td> x3 </td><td> 0.490 </td><td colspan = '1'> \_ \tabularnewline
#>  <tr><td></td><td>(  0.507) </td><td>\tabularnewline
#>  <tr><td> x4 </td><td> -0.730 </td><td colspan = '1'> \_ \tabularnewline
#>  <tr><td></td><td>(  0.457) </td><td>\tabularnewline
#>  <tr><td> x5 </td><td> 0.170 </td><td colspan = '1'> \_ \tabularnewline
#>  <tr><td></td><td>(  0.533) </td><td>\tabularnewline
#>  <tr><td> x6 </td><td> 1.028 </td><td colspan = '1'> \_ \tabularnewline
#>  <tr><td></td><td>(  0.609) </td><td>\tabularnewline
#>  <tr><td> x1:x2 </td><td> -0.063 </td><td colspan = '1'> \_ \tabularnewline
#>  <tr><td></td><td>(  0.065) </td><td>\tabularnewline
#>   <tr><td>N</td><td colspan = '1'> 100</td><td colspan = '1'> 100 \tabularnewline
#>  <tr><td>RMSE</td><td>50.572 </td><td>51.886\tabularnewline
#>  <tr><td>R<sup>2</sup></td><td>0.138 </td><td>0.043\tabularnewline
#>  <tr><td>adj R<sup>2</sup></td><td>0.072 </td><td>0.024\tabularnewline
#>  <tr><td>F( df_{num , df_{denom )</td><td colspan = '1'> 2.11(7,92) </td><td colspan = '1'> 2.2(2,97)\tabularnewline
#>  <tr><td>BIC</td><td colspan = '1'> 1101.58 </td><td colspan = '1'> 1088.97\tabularnewline
#>   <tr><td></tr></td>
#>  <tr><td colspan = '3'>*  p&#8804; 0.05 *\!\!*  p&#8804; 0.01 *\!\!*\!\!*  p&#8804; 0.01 \tabularnewline
#>  </table>
## Run this for yourself, it will create the output file funky2.html
## outreg2HTML(m2out, filename = "funky2.html")
## Please inspect the file "funky2.html