Description Usage Arguments Details Value Create Data Create Tables Conduct Tests Odds Ratios Create Plots Author(s)

`analyzeRq1(brfss)`

Performs analysis of research question 1:
Is there an association between education and income and the prevalence
of depression?

1 | ```
analyzeRq1(brfss)
``` |

`brfss` |
Data frame of preprocessed 2013 Behavioral Risk Factor Surveillance System (BRFSS) telephone survey. |

Function that performs the analysis for research question #1: Is there an association between education and income and the prevalence of depression? The function contains __ primary sections: (!) create Data, (2), create tables, (3), conduct tests, (4) compute oods ratios, and (5) render plots.

A nested list containing marginal, conditional, and joint association frequencies and proportions, plots, statistical tests and odds ratios. The return variables are as follows:

freqDepression diagnosis frequency table

jointFreqIncome and education joint association frequency table

jointPropIncome and education joint association proportion table

condFreqIncome and education conditional association frequency table

condPropIncome and education conditional association proportion table

incomeTableDepression diagnoses by income table

incomeFreqFrequency of depression diagnoses by level of income table

incomePropProportion of depression diagnoses by level of income table

educationTableDepression diagnoses by education table

educationFreqFrequency of depression diagnoses by level of education table

educationPropProportion of depression diagnoses by level of education table

interactionTableDepression diagnoses by income/education interaction table

interactionFreqFrequency of depression diagnoses by income/education interaction table

interactionPropProportion of depression diagnoses by income/education interaction table#'

freqDfFrequency of depression diagnoses by income/education joint association in data frame format

propDfProportion of depression diagnoses by income/education joint association in data frame format

incomeFreqDfFrequency of depression diagnoses at each level of income in data frame format

incomePropDfProportion of depression diagnoses at each level of income in data frame format

educationFreqDfFrequency of depression diagnoses at each level of education in data frame format

educationPropDfProportion of depression diagnoses at each level of education in data frame format

interactionFreqDfFrequency of depression diagnoses at each level of income/education interaction in data frame format

interactionPropDfProportion of depression diagnoses at each level of income/education interaction in data frame format

incomeFreqFrequency of depression diagnoses by level of income plot

incomePropProportion of depression diagnoses by level of income plot

educationFreqFrequency of depression diagnoses by level of education plot

educationPropProportion of depression diagnoses by level of education plot

conditionalPropProportion of depression diagnoses by level of income/education interaction, holding education constant

incomeIndTest of marginal independence of income on depression

educationIndTest of marginal independence of education on depression

incomeIndVCramer's V measure of strength of association of income and depression

educationIndVCramer's V measure of strength of association of education and depression

jointIndTest of joint independence of income and education on depression

jointIndVCramer's V measure of strength of the joint association of education and income on depression

condIndTest of conditional independence of income on depression, given education

anovaTest of relative effects of income and education on depression

incomeOddsOdds of a depression diagnosis at each level of income

educationOddsOdds of a depression diagnosis at each level of education

conditionalOddsOdds of a depression diagnosis at each level of income, given education

interactionOddsOdds of a depression diagnosis at each level of income and education

This section filters the preprocessed BRFSS data to include valid values of income, education and a depression diagnosis. An incoime/education interaction variable is created. Finally depression diagnosis data is rendered by income, education and the income/education interaction variable. The variables are as follows:

rq1DataSubset of BRFSS data including valid values for Income, Education, and Depression Diagnosis

rq2Data$IncomeEducationIncome/Education interaction variable

rq1IncomeDataIncome and depression diagnosis data from preprocessed BRFSS data

rq1EducationDataEducation and depression diagnosis data from preprocessed BRFSS data

rq1InteractionDataIncome / Education interaction and depression diagnosis data from preprocessed BRFSS data

This section converts the income, education and depression diagnosis data to frequency, proportion, interaction, joint frequency, joint proportion, conditional frequency and conditional proportion tables, The variables are:

rq1Tablerq1Data in table format

rq1IncomeTablerq1IncomeData in table format

rq1EducationTablerq1EducationData in table format

rq1InteractionTablerq1InteractionData in table format

rq1IncomeFreqTableFrequencies of depression diagnoses by income level

rq1IncomePropTableProportions of depression diagnoses by income level

rq1EducationFreqTableFrequencies of depression diagnoses by education level

rq1EducationPropTableProportions of depression diagnoses by education level

rq1JointFreqFrequencies of depression diagnoses by income and education level

rq1JointPropProportions of depression diagnoses by income and education level

rq1CondFreqFrequencies of depression diagnoses by income, given education level education level

rq1JointFreqFJoint frequency table in data frame format.

rq1IncomeFreqFIncome frequency table in data frame format.

rq1EducationFreqFEducation frequency table in data frame format.

rq1InteractionFreqFIncome/education interaction frequency table in data frame format.

rq1JointPropFJoint proportion table in data frame format.

rq1IncomePropFIncome proportion table in data frame format.

rq1EducationPropFEducation proportion table in data frame format.

rq1InteractionPropFIncome/education interaction proportion table in data frame format.#'

This section performs the statistical tests that reveal the associations between depression and income and education. First, chi-squaared tests are conducted to ascertain marginal and joint independence of income and education and depression diagnoses. Cramer's V tests quantified the strength of any association. The Cochran-Mantel-Haenszel test was administered to measure three-way independence between depression diagnoses and income and education. The variables are as follows:

rq1IncomeIndChi-squared tests of marginal indpendence of income on depression

rq1EducationIndChi-squared tests of marginal indpendence of education on depression

rq1JointIndChi-squared tests of joint indpendence of income and education on depression

rq1IncomeIndVCramer's V test of the strength of the association of income and depression

rq1EducationIndVCramer's V test of the strength of the association of education and depression

rq1JointIndVCramer's V test of the strength of the joint association of education and income on depression

rq1CondIndCochran-Mantel-Haenszel test of conditional independence

rq1CondIndDfCochran-Mantel-Haenszel test of conditional independence in data frame format

rq1AnovaTests to determine which indpendent variable has greatest effect on the response, depression diagnoses

This section computes the odds ratios for marginal, conditional and joint associations. The variables are as follows:

rq1IncomeOddsThe marginal odds of a depression diagnosis at each level of income

rq1IncomeOddsThe marginal odds of a depression diagnosis at each level of education

rq1ConditionalOddsThe odds of a depression diagnosis at each level of income, given education

rq1InteractionOddsThe odds of a depression diagnosis at each level of income and education

This section renders the plots for this analysis. Stacked bar plots showing marginal frequency and proportions are rendered for both income and education. Conditional proportion plots are rendered for education and income interaction, holding education constant. The variables are:

rq1IncomeFreqBarStacked bar plot of the frequencies of depression diagnoses at all income levels

rq1IncomePropBarStacked bar plot of the proportions of depression diagnoses at all income levels

rq1EducationFreqBarStacked bar plot of the frequencies of depression diagnoses at all education levels

rq1EducationPropBarStacked bar plot of the proportions of depression diagnoses at all education levels

rq1ConditionalPlotsStacked bar plot of the proportions of depression diagnoses at all income/education levels, holding education constant

John James, jjames@datasciencesalon.org

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.