crossplot_stats: Basic Statistics for regression varaibles and plotting

Description Usage Arguments Value

View source: R/crossplot_stats.R

Description

This function will plot either an unweighted or weighted regression line and print summary statistics. Log regressions are also permitted

Usage

1
2
3
crossplot_stats(p, log.reg = FALSE, weighted = FALSE,
  sprintf.format = "%.2f", xlabel = NULL, ylabel = NULL,
  reg.label.se = TRUE, mean.label.se = FALSE)

Arguments

p

a crossplot ggplot2 plot. Can be generated from crossplot

log.reg

logical variable that indicates if the regression should be run in logs. Defaults to FALSE

weighted

logical variable that indicates if the the regression will be weighted by the size variable from the plot. Defaults to FALSE

sprintf.format

the string format for the stats in sprintf.

xlabel

a string with the name for the x-variable. Defaults to NULL. If set to NULL, the variable name from the x-axis will be used

ylabel

a string with the name for the y-variable. Defaults to NULL. If set to NULL, the variable name from the y-axis will be used

reg.label.se

logical. If set to TRUE, the regression standard errors will be printed

mean.label.se

logical. If set to TRUE, the standard errors for the means will be printed.

Value

a list of two data.frames with the crossplot stats. The first element of the list, plot.stats holds a data.frame of the stats in numeric format. The second element of the list plot.stats.pretty holds a data.frame of the stats in a pretty stringr format using sprintf. The data.frame will include the following variables: "slope", "slope.se", "intercept", "intercept.se", "r.squared", "adj.r.squared", "mean.x", "mean.y" "var.x", "var.y", "sd.x", "sd.y". The standard errors for the slope and the intercept will be printed in parentheses next to the coefficient in the labels. For the labels of the means, variances, or standard deviations, xlabel and ylabel will be used for the labels. Standard errors will be heteroskedasticity-robust white standard errors


ChandlerLutz/crossplotr documentation built on May 6, 2019, 9:56 a.m.