Learn R Programming

DFA.CANCOR (version 0.2.2)

linearity: Linearity

Description

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

Usage

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

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.

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.

References

Tabachnik, B. G., & Fidell, L. S. (2013). Using multivariate statistics (6th. ed., pp. 83-84). New York, NY: Pearson.

Examples

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

# }
# NOT RUN {
# 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 )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab