Skip to contents

Returns a table based on the information of a multi_compare_object which can be outputted as HTML or LaTex Table, for example with the help of the stargazer function.

Usage

multi_compare_table(
  multi_compare_objects,
  type = "diff",
  names = NULL,
  ndigits = 3,
  envir = parent.frame()
)

Arguments

multi_compare_objects

One or more object that were returned by multi_compare.

type

A character string, to determine the type of regression table.

  • If "dfs" a regression table based on the data frame(s) is returned.

  • If "benchmarks" a regression table based on the benchmark(s) is returned.

  • If "diff" a table indicating the difference between the df(s) and the benchmark(s) is returned.

names

A character vector to rename the data frames of comparison.

ndigits

The Number of digits that is shown in the table.

envir

The environment, where the multi_core_objects can be found.

Value

A table containing information on the multivariate comparison based on the multi_compare function.

Examples


## Get Data for comparison
require(wooldridge)
card<-wooldridge::card

south <- card[card$south==1,]
north <- card[card$south==0,]
black <- card[card$black==1,]
white <- card[card$black==0,]

## use the function to plot the data
multi_data1 <- sampcompR::multi_compare(df = north, 
                                         bench = south,
                                         independent = c("age","fatheduc","motheduc","IQ"),
                                         dependent = c("educ","wage"),
                                         family = "ols") 
#> 
#> Difference in coeficients between sets of respondents 
#>  
#>          educ         wage        
#> age      -7.91e-02*   -3.74e+00   
#> fatheduc -4.41e-02    -3.11e+00   
#> motheduc 4.34e-02     5.40e+00    
#> IQ       -1.85e-02**  8.34e-01    
#> 
#> Overall difference between north & south: 25% of coeficients are significant different
#> (*p<0.05 ; **p<0.005 ; ***p<0.001;  for t-test robust standard errors are used) 
#>  
                                     
multi_data2 <- sampcompR::multi_compare(df = black, 
                                         bench = white,
                                         independent = c("age","fatheduc","motheduc","IQ"),
                                         dependent = c("educ","wage"),
                                         family = "ols") 
#> 
#> Difference in coeficients between sets of respondents 
#>  
#>          educ         wage        
#> age      7.05e-02     1.27e+01    
#> fatheduc 7.38e-02     4.91e-01    
#> motheduc -1.13e-01    6.94e-01    
#> IQ       2.89e-02**   -5.40e-01   
#> 
#> Overall difference between black & white: 12.5% of coeficients are significant different
#> (*p<0.05 ; **p<0.005 ; ***p<0.001;  for t-test robust standard errors are used) 
#>  
                                     
table<-multi_compare_table(c("multi_data1","multi_data2"),type="diff")

noquote(table)
#>       data_frames variables educ       wage      
#>  [1,] north       age       -0.079*    -3.740    
#>  [2,]                       (0.034)    (4.455)   
#>  [3,]             fatheduc  -0.044     -3.110    
#>  [4,]                       (0.035)    (4.582)   
#>  [5,]             motheduc    0.043      5.400   
#>  [6,]                       (0.041)    (5.376)   
#>  [7,]             IQ        -0.019**     0.834   
#>  [8,]                       (0.007)    (0.911)   
#>  [9,] black       age         0.070     12.700   
#> [10,]                       (0.054)    (7.095)   
#> [11,]             fatheduc    0.074      0.491   
#> [12,]                       (0.055)    (7.236)   
#> [13,]             motheduc  -0.113       0.694   
#> [14,]                       (0.06)     (7.937)   
#> [15,]             IQ          0.029**  -0.540    
#> [16,]                       (0.011)    (1.423)