Skip to contents

Plot a object generated by biv_compare function as a heatmap.

Usage

heatmap_biv_compare(
  biv_data_object,
  value = "AAB",
  summet_transparance = 0,
  summetric = TRUE,
  summet_size = 4.5,
  ndigits_summet = 3,
  upper_limit = NULL,
  lower_limit = NULL,
  corr_size = 3,
  ndigits_number = 2,
  varlabels = NULL,
  plots_label = NULL,
  grid = "white",
  colors = c("#8ECCEE", "#1F45F9"),
  number_color = "white",
  ncol_facet = 3,
  legend_title = NULL,
  interest_breaks = NULL,
  interest_labels = NULL,
  plot_title = NULL
)

Arguments

biv_data_object

A object generated by the biv_compare function.

value

A character string which is either "AAB" or "AARB". AAB means that the Absolute Difference in Pearson's r estimates between dfs and the benchmarks should be displayed in the tiles by number and color. AARB means that the Absolute Relative Difference should be displayed instead.

summet_transparance

A number to determine the transparency of the displayed summetric.

summetric

If TRUE Average Absolute Difference (AAB) and the Average Absolute Relative Difference (AARB) of Pearson's r values between the dfs and the benchmarks is displayed in the plot.

summet_size

A number to determine the size of the displayed summetric in the plot.

ndigits_summet

The maximum number of digits for numbers displayed in the summertic of the plot.

upper_limit, lower_limit

A numeric value, indicating the highest or lowest value that should be displayed in the tiles by number and color. This does not affect the summetric. However, it can be used to keep differences between values visible in the heatmap, even in the presence of strong ouliers.

corr_size

The font size of correlation numbers displayed in the tiles of the heatmap.

ndigits_number

The maximum digits of numbers displyed in the tiles of the heatmap.

varlabels

A character string or vector of character strings containing the new labels of variables that are used in the plot.

plots_label

A character string or vector of character strings containing the new labels of the data frames that are used in the plot.

grid

A character string, that determines the color of the lines between the tiles of the heatmap.

colors

A vector of two colors used in the heatmap.

number_color

A character string indicating the color of the numbers, displayed in the tiles.

ncol_facet

Number of columns used in faced_wrap() for the plots.

legend_title

A character string indicating the title of the legend of the plot.

interest_breaks

A numeric vector indicating the breaks for the color scheme displayed in the legend of the heatmap.

interest_labels

A character vector indicating the labels for the breaks displayed in the legend of the heatmap.

plot_title

A character string containing the title of the plot.

Value

A object generated with the help of ggplot2::ggplot2(), used to visualize a heatmap of the bivariate differences between the data frames and benchmarks.

Details

The plot shows a heatmap of a correlation matrix, where the colors are determined by the Absolue Difference or the Absolute Relative Difference in Pearson's r estimates between the data frames and the benchmarks.

Examples


## Get Data for comparison

data("card")

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

## use the function to plot the data 
bivar_data<-sampcompR::biv_compare(dfs = c("north","white"),
                                   benchmarks = c("card","card"),
                                   variables= c("age","educ","fatheduc","motheduc","wage","IQ"),
                                   data=TRUE)
#> Error in get(dfs[i]): object 'north' not found

Absolute_Bias_Plot<-sampcompR::heatmap_biv_compare(bivar_data,value = "AAB")
#> Error: object 'bivar_data' not found
Absolute_Bias_Plot
#> Error: object 'Absolute_Bias_Plot' not found

Absolute_Relative_Bias_Plot<-sampcompR::heatmap_biv_compare(bivar_data,value = "AARB")
#> Error: object 'bivar_data' not found
Absolute_Relative_Bias_Plot
#> Error: object 'Absolute_Relative_Bias_Plot' not found