pt_transform: Plotting of variable transformations

View source: R/pt_transform.R

pt_transformR Documentation

Plotting of variable transformations

Description

This function helps users to determine whether a transformation of log or square-root would be appropriate for a specific purchase task indicator. Specifically, it provides values which measure skewness and kurtosis, as well as the minimum and maximum values of z-scores.

Usage

pt_transform(pt, pt_var, zero_val = 0.001, distribution = TRUE)

Arguments

pt

A data frame consisting of the purchase variable 'pt_var' to visualize.

pt_var

The name of the purchase task variable to visualize, as identified in the data frame.

zero_val

The small constant value to add to zero-value responses to allow for transformation. The default is 0.001.

distribution

A logical argument on whether a plot should be produced. The default is TRUE.

Value

A data frame with transformation diagnostics for the 'pt_var'. If distribution is set to TRUE, then a ggplot2 graphical object is also returned.

Examples

### --- Example Data

pt <- data.frame("ID" = c(1:36),
"Breakpoint" = c(1,2,5,0,10,3,0.5,0.2,0.3,3,4,5,7.5,0.5,2,0,0.1,
                 0.5,0.5,0,3,2,2,1,2,3,4,1,0,2,0,5,5,7.5,2,3))

### --- Function Example

pt_transform(pt, pt_var = "Breakpoint")


PBCAR/PThelper documentation built on May 13, 2024, 3:45 p.m.