rita_plotting: Rita plotting profiles and retained plotting data

rita_plottingR Documentation

Rita plotting profiles and retained plotting data

Description

Rita retains the original and selected transformed observations in an additive rita_plotting attribute. This is separate from the unchanged rita_analysis schema. Both positional return elements retain their meanings: data, followed by lattice plotting objects. No analysis-result class is added.

Details

With autoPlot=TRUE, plot_profile="compact" is the default. Each variable has an original histogram (using Rita's existing integer-valued feature detection) or density on the left and its selected transformed density on the right. Variables follow retained input-column order. Three variable pairs per page is the default; plots_per_page changes this. Both axes have panel-specific ranges; original and transformed units differ. Histograms show percent per bin; densities show density in the corresponding measurement units. No strip or violin plots are included in compact mode.

plot_profile="full" retains the historical repertoire and grouping: paired original/transformed main plots (integer-valued originals first), followed by original strip plots for at most 20 distinct values and 150 observations, otherwise violin/boxplots. It returns the historical two-group nested list, without pagination. Nine variables therefore yield 27 trellis objects in full mode versus three six-panel trellis pages in compact mode.

plot_profile="qq" uses the same pagination and variable/stage order as compact. Sorted observations are plotted against qnorm(ppoints(n)), with standard-normal theoretical quantiles. The dashed reference line joins the observed 25th and 75th percentiles (R quantile type 7) at the corresponding standard-normal quantiles. It is not a fitted least-squares line or a confidence envelope. The transformed panel labels the already-retained QQ-correlation-squared score. Better visual alignment does not establish normality or validate inference after selecting a transformation on the same observations.

Precedence is explicit: with autoPlot=TRUE, the selected profile controls plots and all five manual flags are ignored. With autoPlot=FALSE, the profile and pagination arguments are ignored, and only histPlot, densPlot, stripPlot, violinPlot, and xformPlot apply. The five historical groups (including empty groups) remain in position 2. With all flags FALSE, no plots are generated, but plotting data are still retained. display_plots=FALSE suppresses automatic drawing and keeps the console statistics and plot objects. For batch analysis, assign the result, for example fit <- Rita(mtcars, display_plots=FALSE). Printing the plot collection explicitly or through R's auto-printing can open the default graphics device.

RitaPlots(result, plot_profile, plots_per_page, display_plots=FALSE) builds another profile using saved observations, even after a no-plot call or a call with return=FALSE. It never reruns transformations, selection, normality tests or sampling. Density estimation and plotting coordinates are prepared as needed. Print an individual returned trellis object to draw or export it deliberately. For three pairs per page, a device approximately 10 by 10 inches is recommended. A 5-by-5-inch device uses fewer ticks and fits labels to the width of each strip. Long names may show their input column number and an abbreviated name. Use fewer pairs on shorter devices. Very narrow strips may abbreviate the transformation or show only the QQ score when space permits. Full labels and scores remain in rita_plotting.

Generation alone does not draw random numbers. Existing lattice rendering of jittered density rugs and strip plots may advance the caller's RNG, including on reprinting. Jitter is not redesigned here. Compact omits supplemental strips and changes plotting order, so its rendering-time RNG consumption can differ from full. QQ rendering consumes no RNG. Rita's explicit seed remains scoped to the Rita call; later printing or RitaPlots display is outside that scope. Plots use all cleaned observations, not just a Shapiro-Wilk random subsample.

Schema version 1

attr(result,"rita_plotting") is a list containing:

schema_version

Integer 1.

profile

Active profile: compact, full, qq or manual.

plots_per_page

Configured variables per page for compact/QQ; NULL otherwise.

display

Whether automatic drawing was requested.

data

One record per retained variable in input order.

Each data record contains original_position and variable, matching rita_analysis$selection; original_rows, matching rita_analysis$cleaning$retained_rows; numeric original and transformed vectors in that row order; canonical transformation; transformed_label; and the existing selection_score. stages is original then transformed. original_plot, transformed_plot, and supplemental_plot describe the existing feature-detection choices. qq documents probabilities, theoretical distribution and reference-line convention. These observations and conventions suffice to regenerate QQ coordinates deterministically. Original column position, not a possibly duplicated variable name, identifies a record.

Each compact/QQ trellis page also has a rita_panels attribute, ordered left to right, top to bottom. Records retain original position, variable, stage, transformation, type, original rows and observations. QQ panels additionally retain a coordinates data frame (original_row, theoretical, observed) and reference (intercept, slope). Tied observations remain individually identified in sorted order. Non-QQ coordinates/reference are NULL. Actual lattice panel arguments are constructed from these same observations.

Examples

fit <- Rita(mtcars, display_plots=FALSE)
length(fit[[2]]) # three compact pages
attr(fit,"rita_plotting")$data[[1]]$original
print(fit[[2]][[1]])
full <- RitaPlots(fit,"full")
qq <- RitaPlots(fit,"qq",plots_per_page=2)
attr(qq[[1]],"rita_panels")[[1]]$coordinates

Rita documentation built on Nov. 14, 2026, 1:07 a.m.

Related to rita_plotting in Rita...