PLOT_LINEARITY: Plot for linearity

View source: R/PLOT_LINEARITY.R

PLOT_LINEARITYR Documentation

Plot for linearity

Description

Plots the linear, quadratic, and loess regression lines for the association between two continuous variables.

Usage

PLOT_LINEARITY(data, idv, dv, groups=NULL, groupNAME=NULL, legposition=NULL, 
	                  leginset=NULL, verbose=TRUE)

Arguments

data

A dataframe where the rows are cases & the columns are the variables.

idv

The name of the predictor variable.

dv

The name of the dependent variable.

groups

(optional) The name of the groups variable in the dataframe,
e.g., groups = 'Group'.

groupNAME

(optional) The value (level, name, or number) from the groups variable that identifies the subset group whose data will be used for the analyses,
e.g., groupNAME = 1.

legposition

(optional) The position of the legend, as specified by one of the
following possible keywords: "bottomright", "bottom", "bottomleft",
"left", "topleft", "top", "topright", "right" or "center".

leginset

(optional) The inset distance(s) of the legend from the margins as a
fraction of the plot region when legend is placed by keyword.

verbose

Should detailed results be displayed in the console?
The options are: TRUE (default) or FALSE.

Value

If verbose = TRUE, the linear and quadratic regression coefficients and their statistical tests are displayed.

The returned output is a list with the regression coefficients and the plot data.

Author(s)

Brian P. O'Connor

References

Tabachnik, B. G., & Fidell, L. S. (2019). Using multivariate statistics (7th ed.). New York, NY: Pearson.

Examples

# data that simulate those from De Leo & Wulfert (2013)
PLOT_LINEARITY(data=data_CANCOR$DeLeo_2013, groups=NULL, 
               idv='Family_Conflict', dv='Grade_Point_Average', verbose=TRUE)


# data from Sherry (2006), ignoring the groups
PLOT_LINEARITY(data=data_DFA$Sherry_2006, groups=NULL, groupNAME=NULL,
               idv='Neuroticism', dv='Conscientiousness', verbose=TRUE)

# data from Sherry (2006), group 2 only
PLOT_LINEARITY(data=data_DFA$Sherry_2006, groups ='Group', groupNAME=2,
               idv='Neuroticism', dv='Conscientiousness', verbose=TRUE)
 


DFA.CANCOR documentation built on July 9, 2023, 6:05 p.m.