*! version 1.0 12jul2023

svycanon-- Canonical correlation analysis for complex survey data

Syntax

svycanon
[, options]

Model
svysetcom(str) specifies the svy options required for the accurate analysis of the data set.

Reporting
howmany(#) allows the user to choose for number of canonical correlations for which the statistical significance statistics are displayed.

firstdim(#) determines which canonical variate serves as the horizontal axis in the variables graph.

secdim(#) determines which canonical variate serves as the horizontal axis in the variables graph.

freq(str) allows the user to choose whether the type of sample size is equal to the number of rows in the data set or the sum of the survey weights.

Description

The post estimation command svycanon extends the functionality of canon by calculating the test statistics, degrees of freedom and p-values necessary to assess the statistical significance of the secondary canonical correlations (CC).

This is done according to the methods Wilks' lambda, Pillai's trace, and Hotelling-Lawley trace (Caliński et al., 2006) and Roy's largest root (Johnstone, 2009).

svycanon also implements an algorithm (Cruz-Cano et al., 2024) that allows the inclusion of complex survey design factors (CSD), e.g., strata, cluster and replicate weights, in the estimation of the statistical significance of the CC.

The algorithm's core idea is to calculate the correlations among the canonical variates and their corresponding statistical significance via an equivalent sequence of univariate linear regression models.

This transformation allows the user to utilize the existing resources that can integrate CSD factors into these regression models (Valliant and Dever, 2018). Hence, this algorithm can incorporate the same CSD factors as svy:reg.

The units and variables graphs (Gittins, 1986) can also be drawn by svycanon further complementing the information listed by the existing canon post estimation commands.

Examples from the Wave 1 of the Population Assessment of Tobacco and Health (PATH) study (Hyland et al., 2017) and the 2021 National Youth Tobacco Survey (Gentzke et al., 2022) are included as examples.

svycanon typed without arguments displays the values needed to assess the statistical significance of the canonical correlations obtained using a classic canonical correlation analysis.

The canonical structure variables must be set beforehand by canon, see help canon.

Warning: Use of if, by, or in restrictions has not been incorporated yet in svycanon.

Options

Model

svysetcom(str) specifies the svy options required for the accurate analysis of the data set. If this option is set to "classic" or missing, then it is assumed the data comes from a simple random sample of the population and hence no complex survey design elements need to be specified.

Reporting

howmany(#)} allows the user to choose for number of canonical correlations for which the statistical significance statistics are displayed. Notice that regardless of the value or this option, all canonical correlations are evaluated, i.e. this option just determines how many results are shown. If this option is not used, then all possible canonical correlations are presented.

firstdim(#) determines the which canonical variate serves as the horizontal axis in the variables graph. If this option is not used, then then no plots are displyed.

secdim(#) determines the which canonical variate serves as the horizontal axis in the variables graph.

freq(str) allows the user to choose whether the sample size should be considered equal to the number of rows in the data set or the sum of the survey weights.

Examples

Setup Simple Automobile Example

. use https://www.stata-press.com/data/r17/auto, clear

. canon (displacement mpg gear_ratio turn) (length weight headroom trunk)

Estimate canonical correlations p-values for Simple example

. svycanon, svysetcom("classic") howmany(3)

Setup PATH Example

. use svycanonPATHStudyWave1example, clear

. canon (R01_AC1022 R01_AE1022 R01_AG1022CG) (R01_AX0075 R01_AX0076) [weight=R01_A_PWGT]

Estimate canonical correlations p-values for PATH Example

. svycanon , svysetcom("svyset [pweight= R01_A_PWGT], brr(R01_A_PWGT1 - R01_A_PWGT100) vce(brr) mse fay(.3)") howmany(2) firstdim(1) secdim(2)

Setup NYTS Example

. use svycanonNYTS2021example, clear

. canon (qn9 qn38 qn40 qn53 qn54 qn64 qn69 qn74 qn76 qn78 qn80 qn82 qn85 qn88 qn89) (qn128 qn129 qn130 qn131 qn132 qn134) [weight=finwgt]

Estimate canonical correlations p-values for NYTS Example

. svycanon , svysetcom("svyset [pweight=finwgt], psu(psu2) strata( v_stratum2)") howmany(3)

Stored results

svycanon stores the following in r():

Matrices

r(WilksStat) test statistic for Wilk's lambda

r(WilksDf1) degrees of freedom for Wilk's lambda Chi-square distribution

r(WilksChiSq) value for Wilk's lambda Chi-square test statistic

r(WilksPval) p-value for Wilk's lambda Chi-square test

r(PillaisStat) test statistic for Pillai's trace

r(PillaisDf1) degrees of freedom for Pillai's trace Chi-square distribution

r(PillaisChiSq) value for Pillai's trace Chi-square test statistic

r(PillaisPval) p-value for Pillai's trace Chi-square test

r(HotellingStat) test statistic for Hotelling-Lawley trace

r(HotellingDf1) degrees of freedom for Hotelling-Lawley trace Chi-square distribution

r(HotellingChiSq) value for Hotelling-Lawley trace Chi-square test statistic

r(HotellingPval) p-value for Hotelling-Lawley trace Chi-square test

r(RoysStat) test statistic for Roy's greatest root

r(RoysDf1) degrees of freedom for Roy's greatest root Chi-square distribution

r(RoysChiSq) value for Roy's greatest root Chi-square test statistic

r(RoysPval) p-value for Roy's greatest root Chi-square test

r(WtSCCStat) test statistic for the Survey CC algorithm using only the survey weights

r(WtSCCDf1) numerator degrees of freedom for the Survey CC algorithm using only the survey weights

r(WtSCCDf2) denominator degrees of freedom for the Survey CC algorithm using only the survey weights

r(WtSCCF) value for the Survey CC algorithm F distribution using only the survey weights

r(WtSCCPval) p-value for the Survey CC algorithm F distribution using only the survey weights

r(CSCCStat) test statistic for the Survey CC algorithm using all complex survey design elements

r(CSCCDf1) numerator degrees of freedom for the Survey CC algorithm using only the survey weights

r(CSCCDf2) denominator degrees of freedom for the Survey CC algorithm using only the survey weights

r(CSCCF) value for the Survey CC algorithm F distribution using all complex survey design elements

r(CSCCPval) p-value for the Survey CC algorithm F distribution using all complex survey design elements

Authors

Raul Cruz-Cano, Indiana University, Bloomington

<raulcruz@iu.edu>

Acknowledgement

Thanks to Erin Mead-Morse, Aaron Cohen, and Nicolas Escobar Velasquez for their contributions to this work.

References

Cruz-Cano R, Cohen A, and Mead-Morse E. Canonical Correlation Analysis of Survey Data: the SurveyCC R package, The R Journal under review. 2024.

Caliński T., Krzyśko M. and WOłyński W. (2006) A Comparison of Some Tests for Determining the Number of Nonzero Canonical Correlations, Communications in Statistics - Simulation and Computation, 35:3, 727-749, DOI: 10.1080/03610910600716290.

Gentzke AS, Wang TW, Cornelius M, Park-Lee E, Ren C, Sawdey MD, Cullen KA, Loretan C, Jamal A, Homa DM. Tobacco Product Use and Associated Factors among Middle and High School Students - National Youth Tobacco Survey, United States, 2021. MMWR Surveill Summ. 2022;71(5):1-29. doi: 10.15585/mmwr.ss7105a1. PubMed PMID: 35271557.

Gittins R. Canonical Analysis: A Review with Applications in Ecology: Springer Berlin Heidelberg; 1986.

Hyland A, Ambrose BK, Conway KP, et al. Design and methods of the Population Assessment of Tobacco and Health (PATH) StudyTobacco Control. 2017;26:371-378.

Johnstone IM. Approximate Null Distribution of the largest root in a Multivariate Analysis. Ann Appl Stat. 2009;3(4):1616-1633. doi: 10.1214/08-AOAS220. PMID: 20526465; PMCID: PMC2880335.

Valliant R. and Dever JA. Survey Weights: A Step-by-Step Guide to Calculation: Stata Press; 2018. ISBN-13: 978-1-59718-260-7.

Also see

Manual: [U] 30 Overview of survey estimation, [SVY]

On-line: help for svy and canon.