Skip to contents

multi_compare_merge combines two multi_compare_objects to plot them together.

Usage

multi_compare_merge(multi_reg_object1, multi_reg_object2, p_adjust = FALSE)

Arguments

multi_reg_object1, multi_reg_object2

Multireg objects that should be combined.

p_adjust

A logical input or character string indicating an adjustment method that isusable in the method parameter of p.adjust. If set to TRUE the Bonferroni adjusted p-values are used in inference.

Value

A combined multi_reg_object that can be used in plot functions to create a visualization.

Examples


## Get Data for comparison
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"),
                                        family = "ols") 
#> 
#> Difference in coeficients between sets of respondents 
#>  
#>          educ        
#> age      -7.91e-02*  
#> fatheduc -4.41e-02   
#> motheduc 4.34e-02    
#> IQ       -1.85e-02** 
#> 
#> Overall difference between north & south: 50% 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("wage"),
                                        family = "ols") 
#> 
#> Difference in coeficients between sets of respondents 
#>  
#>          wage        
#> age      1.27e+01    
#> fatheduc 4.91e-01    
#> motheduc 6.94e-01    
#> IQ       -5.40e-01   
#> 
#> Overall difference between black & white: 0% of coeficients are significant different
#> (*p<0.05 ; **p<0.005 ; ***p<0.001;  for t-test robust standard errors are used) 
#>  
 ### merge two objects ###                                       
 merged_object<-multi_compare_merge(multi_data1,multi_data2)
 
 ### Plot the merged object ###
 plot_multi_compare("merged_object")                                       
#> Error in get(multi_compare_objects[i]): object 'merged_object' not found