plot univar data
plot_uni_compare.Rd
plot_uni_compare
This uses ggplot2 to generate a plot based on an object
generated by the uni_compare
function.
Usage
plot_uni_compare(
uni_compare_objects,
name_dfs = NULL,
name_benchmarks = NULL,
summetric = NULL,
colors = NULL,
shapes = NULL,
legendlabels = NULL,
legendtitle = NULL,
label_x = NULL,
label_y = NULL,
summet_size = NULL,
plot_title = NULL,
conf_adjustment = FALSE,
varlabels = NULL,
ndigits = 3
)
Arguments
- uni_compare_objects
A object generated by the
uni_compare
function.- name_dfs, name_benchmarks
A character string or vector of character strings containing the new names of the data frames and the benchmarks, that are used in the plot.
- summetric
If
"avg1"
,"avg2"
,"mse1"
,"mse2"
,"rmse1"
,"rmse2"
, or"R"
the respective measure is calculated for the biases of each survey. The values"avg1"
,"mse1"
and"rmse1"
lead to similar results as in"avg2"
,"mse2"
and"rmse2"
, with slightly different visualization in the plot. Ifsummetric = "none"
, nosummetric
will be displayed in the plot, and ifsummetric = NULL
thesummetric
specified in the uni_compare_object is used.- colors
A vector of colors that is used in the plot for the different comparisons.
- shapes
A vector of shapes applicable in
ggplot2::ggplot2()
that is used in the plot for the different comparisons.- legendlabels
A character string or vector of strings containing a label for the legend.
- legendtitle
A character string containing the title of the legend.
- label_x, label_y
A character string or vector of character strings containing a label for the x-axis and y-axis.
- summet_size
A number to determine the size of the displayed
summetric
in the plot.- plot_title
A character string containing the title of the plot.
- conf_adjustment
If
conf_adjustment = TRUE
the confidence level of the confidence interval will be adjusted with a Bonferroni adjustment, to account for the problem of multiple comparisons.- varlabels
A character string or vector of character strings containing the new names of the variables, also used in plot.
- ndigits
The number of digits to round the numbers in the plot.
Value
Plot of a uni_compare
object using
ggplot2::ggplot2()
which shows the difference between two or more data
frames.
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
univar_data<-sampcompR::uni_compare(dfs = c("north","white"),
benchmarks = c("south","black"),
variables= c("age","educ","fatheduc","motheduc","wage","IQ"),
funct = "abs_rel_mean",
nboots=0,
summetric="rmse2",
data=TRUE)
#> Error in get(dfs[i]): object 'north' not found
sampcompR::plot_uni_compare(univar_data)
#> Error: object 'univar_data' not found