plot_avg_contour: Plots average contour surface of looks to a given interest...

Description Usage Arguments Examples

View source: R/plotting.R

Description

plot_avg_contour calculates the conditional average of proportions or empirical logit looks to a given interest area by Time and a specified continuous variable. It then applies a 3D smooth (derived using gam) over the surface and plots the results as a contour plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plot_avg_contour(
  data,
  IA = NULL,
  type = NULL,
  Var = NULL,
  Averaging = "Event",
  VarLabel = NULL,
  xlim = NA,
  VWPreTheme = TRUE,
  Colors = c("gray20", "gray90")
)

Arguments

data

A data table object output by either bin_prop. transform_to_elogit, or create_binomial.

IA

A string specifying the column name of the IA to use.

type

A character string indicating "proportion" or "elogit".

Var

A string containing the column name corresponding to the continuous variable.

Averaging

A character string indicating how the averaging should be done. "Event" (default) will produce the overall mean in the data, while "Subject" or "Item" (or, in principle, any other column name) will calculate the grand mean by that factor.

VarLabel

A string specifying the axis label to use for Var.

xlim

A vector of two integers specifying the limits of the x-axis.

VWPreTheme

A logical indicating whether the theme included with the function, or ggplot2's base theme (which any other custom theme could be added).

Colors

A vector of two strings specifying the colrs of the contour shading - The default values represent grayscale.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(VWPre)
# For plotting a conditional contour surface...
plot_avg_contour(data = dat, IA = "IA_1_ELogit", type = "elogit", 
               Var = "Rating", VarLabel = "Accent Rating", xlim = c(0,1000), 
               VWPreTheme = FALSE, Colors = c("red", "white"))

# For a more complete tutorial on VWPre plotting functions:
vignette("SR_Plotting", package="VWPre")

## End(Not run)

VWPre documentation built on Nov. 30, 2020, 1:08 a.m.