Learn R Programming

DFA.CANCOR (version 0.2.3)

LINEARITY: Linearity

Description

Provides tests of the possible linear and quadratic associations between two continuous variables.

Usage

LINEARITY(data, variables, groups, idvs, dv, verbose)

Value

If "variables" is specified, the analyses will be run on the "variables" in "data". If "groups" is specified, the analyses will be run for every value of "groups". 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 their statistical tests.

Arguments

data

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

variables

(optional) The names of the continuous variables in the dataframe for the analyses, e.g., variables = c('varA', 'varB', 'varC').

groups

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

idvs

(optional) The names of the predictor variables, e.g., variables = c('varA', 'varB', 'varC').

dv

(optional) The name of the dependent variable, if output for just one dependent variable is desired.

verbose

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

Author

Brian P. O'Connor

References

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

Examples

Run this code
# data from Sherry (2006), using all variables
LINEARITY(data=data_DFA_Sherry, groups='Group',
          variables=c('Neuroticism','Extroversion','Openness',
                      'Agreeableness','Conscientiousness') )

# \donttest{
# data from Sherry (2006), specifying independent variables and a dependent variable
LINEARITY(data=data_DFA_Sherry, groups='Group',
          idvs=c('Neuroticism','Extroversion','Openness','Agreeableness'),
          dv=c('Conscientiousness'), 
          verbose=TRUE )

# data that simulate those from De Leo & Wulfert (2013)
LINEARITY(data=data_CCA_De_Leo,
          variables=c('Tobacco_Use','Alcohol_Use','Illicit_Drug_Use',
                      'Gambling_Behavior', 'Unprotected_Sex','CIAS_Total', 
                      'Impulsivity','Social_Interaction_Anxiety','Depression',
                      'Social_Support','Intolerance_of_Deviance','Family_Morals',
                      'Family_Conflict','Grade_Point_Average'), 
          verbose=TRUE )
# }

Run the code above in your browser using DataLab