Transcription

Paper 175-2019Choosing Wisely: Using the Appropriate Statistical Test for Trend in SASChristina Park, Jui-Ting Hsiung, Melissa Soohoo, and Elani Streja,University of California, IrvineABSTRACTTests for trend are an informative and useful tool to examine whether means, medians or proportions ofcontinuous or categorical variables increase or decrease across ordered groups. In clinical andepidemiological research, comparisons of baseline patient characteristics (e.g., demographic, clinical andlaboratory data) across ordered levels of the categorized primary exposure are often examined with chisquare or analysis of variance (ANOVA) statistical tests. These latter tests identify the existence ofdifferences in patient characteristics, yet provide little information on trends in the ordered groups. Trendtests provide additional insight into the pattern of the relationship between independent and dependentvariables. Multiple methods are available in SAS to evaluate trends of continuous and categoricalvariables using PROC REG (simple linear regression) and PROC FREQ (Jonckheere-Terpstra, CochranArmitage and Cochran-Mantel-Haenszel tests) statements. However, choosing the appropriate statisticaltest can be a challenge. The choice of tests varies depending on the assumptions about the variable ofinterest including its type and distribution. Selecting an inappropriate test may lead to incorrect inferencesabout the trend of the variable across ordered exposure groups. This is important, especially when theresults from trend tests may influence which variables are considered as covariates in models ofadjustment. In this paper, we aim to (1) describe when to use specific statistical tests to evaluate trends incontinuous or categorical variables across ordered groups, and (2) provide examples of SAS codes fortrend tests and interpret the resulting output.INTRODUCTIONIn epidemiological or clinical cohort research, descriptions of the study population under investigation arenecessary to gain a better understanding of the hypothesis tested, results presented, and conclusionsderived, as well as to make any inferences about potential biases in study results. Most research in thisfield present a description of patient characteristics in the first table of the manuscript, Table 1. This tableprovides information about the study population such as demographic data, comorbidities, and baselinelaboratory measures. For many studies, this information is presented for the total population as a whole.Moreover, when the study examines differences in patient outcomes or clinical presentation according toa certain exposure, patient characteristics by exposure category are often presented as well. Statisticaltests may be utilized to ascertain if patient characteristics differ across exposure groups.When there are only two levels of the exposure category, identifying whether there are statisticaldifferences between groups may be conducted with chi-square tests for categorical characteristics (e.g.,presence of diseases), analysis of variance (t-test or ANOVA) for parametrically distributed continuousvariables (e.g., age), or Mann-Whitney for non-parametric continuous variables (e.g., number of hospitalvisits in the past year). These statistical tests may also be relevant for nominal exposure categories suchas insurance type. However, when examining characteristics across ordered exposure groups, thesepreviously listed statistical tests would identify whether said characteristic in one of the exposurecategories differed from the others, but these tests would not reveal which group was different or whetherthere was an increasing or decreasing trend across the ordered groups.In this paper, we will present information on how to test for statistical trends across ordered groups ofexposure category. We will show how to statistically address the question: Does the patient baselinecharacteristic increase or decrease across incrementally higher or lower levels of the primary exposure?We will also discuss how to select the appropriate statistical test depending on the type and distribution ofvariable examined.1

An overview of the following statistical tests for trend and related SAS codes will be covered:1. Linear Regression2. Jonckheere-Terpstra Test3. Cochran-Armitage Trend Test4. Cochran-Mantel-Haenszel TestMore detailed explanations of these tests and SAS codes can be found in the SAS documentation, aswell as books listed under the Recommended Reading section at the end of this paper.Examples will be illustrated using data from the National Health and Nutrition Examination Survey(NHANES, 2009-2010), a study that assesses the health and nutritional status of the United Statespopulation. NHANES datasets are available for public use and can be downloaded from the Centers forDisease Control and Prevention (CDC) website (CDC/NCHS, 2009-2010). Although we will focus on trendtests in the context of clinical and epidemiological studies for this paper, trend tests can be also be usedin other fields, such as economics, environmental, and public policy research.EVALUATING TYPE AND DISTRIBUTION OF THE DEPENDENT VARIABLEWhen creating a descriptive table, patient characteristics are the dependent variables and ordinalexposure categories are the independent variables. It is important to note that patient characteristics maycome in three types: (1) continuous—parametric, (2) continuous—non-parametric, or (3) categorical(binary and more than two levels). Before deciding on a test for trend, the type and distribution of thedependent variable should be examined and identified.CONTINUOUS VARIABLESVisual and/or statistical tests can be used to assess whether the distribution of your continuousdependent variable is parametric or normal (bell-shaped curve). Examples of visual methods includecreating histograms, boxplots, P-P (probability-probability) plots and Q-Q (quantile-quantile) plots.Additionally, statistical hypothesis tests such as Shapiro-Wilk, Kolmogorov-Smirnov and Anderson-Darlingcan be used to formally assess the normality of continuous data.ParametricAlthough SAS codes such as the UNIVARIATE procedure with the HISTOGRAM statement and theBOXPLOT procedure can separately create figures illustrating the distribution of your continuous variableof interest, the CAPABILITY procedure provides a comprehensive view of multiple evaluations to assessnormality simultaneously. A more detailed explanation of PROC CAPABILITY can be found in SAS/QC 9.3: “Syntax: CAPABILITY Procedure”. In the following example, we examine the distribution of serumalbumin in our dataset using PROC CAPABILITY:proc capability data chol9c normaltest;var alb r;label alb r ”Albumin (g/dL)”;histogram/normal endpoints 3.1 to 5.1 by 0.1;ppplot alb r;run;2

Results from the PROC CAPABILITY statement for albumin are displayed in Output 1:Output 1. Partial Output from PROC CAPABILITY Statement for AlbuminOutput 1 shows a histogram (top left), P-P plot (top right) and tables of Basic Statistical Measures andTests for Normality. Visually, both graphs show that the distribution of albumin is approximately normal.The histogram of albumin levels approximately follows a bell-shaped curve, while on the normal P-P plot,the data points lie roughly along a straight line. Furthermore, the mean and median albumin levels (4.2and 4.3 g/dL, respectively) are close to each other. Statistical tests for normality (Kolmogorov-Smirnov,Cramer-von Mises and Anderson-Darling) suggest that the distribution of albumin is not normal (P-values 0.05), but this may be due to the fact that hypothesis tests are sensitive to sample size. Because of thissensitivity, we are prioritizing the evaluation of the illustrated distribution as to confirm that serum albuminis parametrically distributed.Non-ParametricWe will similarly use PROC CAPABILITY on all continuous variables of interest in our dataset. In this nextexample, we show the distribution of serum triglycerides in our data with PROC CAPABILITY:proc capability data chol9c normaltest;var trig r;label trig r ”Triglycerides (mg/dL)”;histogram/normal endpoints 31 to 757;ppplot trig r;run;3

Results from the PROC CAPABILITY statement for triglycerides are displayed in Output 2:Output 2. Partial Output from PROC CAPABILITY Statement for TriglyceridesFor the distribution of triglyceride levels, the histogram (top left), P-P plot (top right) and Basic StatisticalMeasures and Tests for Normality tables in Output 2 all show that the assumption of normality has likelybeen violated. We see that the histogram of triglyceride levels is right skewed and the data points do notfall along a straight line in the P-P plot. Additionally, the mean and median triglyceride levels (149 and119 mg/dL, respectively) are not near each other. Results from all three tests for normality are significant(P-values 0.05), which suggest that the distribution of triglycerides is not normal. Given these results, weconclude that serum triglyceride levels follow a non-parametric distribution.CATEGORICAL VARIABLESFor data that are categorical, the FREQ procedure can be used to identify the number of levels that thedependent variable of interest contains. Here, we run a PROC FREQ on female and race categoricalvariables by including both variables in the TABLE statement:proc freq data chol9c;table female race;run;4

Results from the PROC FREQ statement for female and race are displayed in Output 3:Output 3. Output from PROC FREQ Statement for Female and RaceAs we see in Output 3, female has two levels, while race has five levels. The statistical tests that we willuse to evaluate test for trend for categorical variables in our dataset will differ for those that are binary(female) or more than 2 levels (race).CHOOSING THE APPROPRIATE TEST FOR TRENDNow that we have determined the type and distribution of each variable of interest, we will identify theappropriate statistical test for trend for the variable type. A flow chart representing the decision sequencesfor selecting the appropriate statistical test for trend and accompanying SAS function for a givendependent variable is presented in Figure 1:Dependent VariableContinuousCategoricalDistribution 2 Levels2 an-MantelHaenszel TestCochran-ArmitageTrend TestLinearRegressionJonckheereTerpstra TestSASProcedurePROC FREQ;TABLE/CMHPROC FREQ;TABLE/TrendPROC REGPROC FREQ;TABLE/JTFigure 1. Flowchart for Selecting the Appropriate Statistical Test for Trend and CorrespondingSAS Procedure Depending on the Type and Distribution of the Dependent Variable of Interest5

Examples of SAS procedures with discussion on the interpretation of the output are provided in the nextsection.CONTINUOUS VARIABLESParametricFor continuous parametric variables, a simple linear regression can be used to assess if the distribution ofthe means of the dependent variable increase or decrease linearly across the ordered categoricalexposure group. The main assumptions of this model include that the dependent variable and errors ofthe linear regression model are normally distributed.Non-ParametricAlternatively, the Jonckheere-Terpstra test is a non-parametric test for continuous variables that candetect a trend between a non-normally distributed dependent variable and an ordered independentvariable. The Jonckheere-Terpstra test is used to test the null hypothesis that there is no difference in themedians among the ordered groups, or the alternative hypothesis that there is an ordered difference inthe medians of the dependent variable.CATEGORICAL VARIABLESBinaryThe Cochran-Armitage trend test can be used to assess whether a trend is present between a binary (twolevels, 0/1) dependent variable and an independent variable that has been categorized into more thantwo ordered categories. The Cochran-Armitage trend test is designed to test the null hypothesis that thereis no ordered differences in the distribution (proportions) of the dependent variable across orderedcategories.More than Two LevelsAlternatively, the Cochran-Mantel-Haenszel statistic is useful for evaluating the overall ordereddifferences in proportions of dependent categorical variables of more than two levels across orderedcategories. The Cochran-Mantel-Haenszel test tests the null hypothesis that the proportions of thedependent variable are the same among the ordered exposure categories.APPLICATIONIn this section, we will show how to evaluate the presence of a trend and estimate P-values for trend foreach variable. In interpreting the test for trend output, a two-sided P-value 0.05 will be consideredstatistically significant. Using a cohort of 5,949 adults with available high-density lipoprotein (HDL)measurements in NHANES 2009-2010, we will apply SAS procedures to describe patient characteristicsand test for trends across four ordered categories of HDL level exposure: 40, 40- 50, 50- 60 and 60mg/dL. PROC MEANS and PROC FREQ were used to describe dependent variables with means standard deviations (continuous—parametric), medians with interquartile ranges (continuous—nonparametric) and proportions (categorical) for the total population and within each HDL category, asappropriate for the variable type.6

Summary estimates are provided in Table 1:Variable*TotalPopulation5,94951 4040- 50HDL (mg/dL)50- 60 60P-value fortrend†N (%)1,278 (21)1,611 (27)1,345 (23)1,715 (29)Female, %31435769 0.0001Race/Ethnicity, % 0.0001Non-Hispanic White4850464749Non-Hispanic Black1713171920Mexican American1922201815Other Hispanic1010111010Other Race-Including65566Multi-RacialAlbumin (g/dL)4.24 0.344.23 0.324.25 0.344.24 0.354.24 0.330.37Triglycerides (mg/dL)119 (79, 182)196 (131, 297) 135 (93, 196)107 (75, 154)85 (61, 119) 0.0001*Data are presented as mean SD, median (interquartile range) or percentage, where appropriate. Percentages are rounded tothe nearest whole number.†P-values for trend were calculated with the use of linear regression, Jonckheere-Terpstra, Cochran-Armitage or CochranMantel-Haenszel tests, where appropriate.Table 1. Baseline Characteristics of 5,949 NHANES Adults by HDL LevelsEXAMPLE 1. CONTINUOUS – PARAMETRICFrom Table 1, we note that the means and standard deviations for serum albumin are nearly identical foreach category of HDL. We will now test whether according to statistical evaluation if there are nodifferences in the albumin means across the ordered HDL groups. Simple linear regression can beapplied using the REG procedure to assess the linear association between the dependent variable serumalbumin (alb r) and independent ordered categorical variable HDL (hdl cat). It is important to note thatthe independent ordered categorical variable (hdl cat) is on the right side of the equal sign in the MODELstatement, as we are modeling how the dependent variable (alb r) changes for each unit increase in theordered categories of HDL:proc reg data chol9c;model alb r hdl cat;run;Results from the PROC REG statement for albumin are displayed in Output 4:Output 4. Partial Output from the PROC REG Statement for AlbuminIn Output 4, the Parameter Estimates table provides the degrees of freedom (DF), parameter estimate,standard error, t Value and P-value for the intercept and HDL category. The parameter estimate (orslope) of HDL category is 0.004. This estimate is interpreted as: for every unit increase in HDL categoryalbumin increases by 0.004 g/dL. The P-value of the slope is 0.37 which is not statistically significant,indicating that our data do not differ from the null hypothesis for this test which is that the mean albuminlevels are the same for each HDL category (as seen in Table 1) or that the slope of the line across HDLcategory is not significantly different from 0 or is flat. This can be further illustrated by examining the fittedplotted line with the residuals from this statistical test.7

EXAMPLE 2. CONTINUOUS – NON-PARAMETRICFor triglycerides (trig r), we observed in Table 1 that the median levels of triglycerides with increasingHDL (from left to right) decrease across HDL ordered categories (hdl cat). Of note, the data may also beinterpreted by reading across columns right to left or across decreasing HDL in Table 1, which shows thatthe median triglyceride levels increase with decreasing HDL. Nonetheless, for this non-parametriccontinuous variable, the PROC FREQ with JT option in the TABLE statement can be used to generate aP-value for test for trend. For more details about the PROC FREQ statement with JT option, see BaseSAS 9.4 : “Jonckheere-Terpstra Test”. In the TABLE statement, we need to indicate our variables ofinterest as a cross tabulation. Following the “/” symbol, we specify the JT and NOPRINT (suppressescontingency table) options:proc freq data chol9c;table trig r*hdl cat/jt noprint;run;Results from the PROC FREQ statement for triglycerides are displayed in Output 5:Output 5. Output from PROC FREQ Statement with JT Option for TriglyceridesAs shown in Output 5, the Jonckheere-Terpstra Test table gives us the test statistic, z statistic, one-sidedand two-sided P-values for triglycerides. Here, the two-sided P-value is 0.0001, which tells us that thereis a significant trend between triglycerides and HDL category. We added this P-value to our Table 1, andcoupled with our observation of the median values, we determine that triglyceride levels decrease as HDLcategory increases.EXAMPLE 3. CATEGORICAL – BINARYWhen we examine the female characteristic in Table 1, we see that the proportion of females acrossordered HDL groups increases from 31 to 69% across increasing HDL category. Since female is a binarycategorical variable, we use the PROC FREQ statement with the TREND option to examine the trend inproportion of females across HDL categories. This code will provide analysis according to the CochranArmitage Trend test. Additional details about the PROC FREQ statement with the TREND option can befound in Base SAS 9.4 Example 3.8: “Cochran-Armitage Trend Test”. In the TABLE statement, we needto include a cross tabulation of female and HDL category (hdl cat) and also specify the TREND andNOPRINT options:proc freq data chol9c;table female*hdl cat/trend noprint;run;8

Results from the PROC FREQ statement with TREND option for female are displayed in Output 6:Output 6. Output from PROC FREQ Statement with TREND Option for FemaleThe Cochran-Armitage Trend Test table in Output 6 contains the z statistic, one-sided and two-sided Pvalues. As we can see from the output showing a two-sided P-value of 0.0001, we determine that thereis a statistically significant relationship between females and HDL categories. By our observation of howthe proportions change across HDL groups, we can state that the proportion of females significantlyincreases with increasing HDL category.EXAMPLE 4. CATEGORICAL – MORE THAN TWO LEVELSLastly, for race, in Table 1 we observe that the proportion of Non-Hispanic Black patients increases, whilethe proportion of Mexican Americans decreases with increasing HDL category (hdl cat). Since race is acategorical variable with more than two levels, we will use the PROC FREQ statement with the CMHoption. You can find more details about the PROC FREQ statement with CMH option in Base SAS 9.4 Example 3.7: “Cochran-Mantel-Haenszel Statistics”. Estimates from the Cochran-Mantel-Haenszel testcan be obtained with the following code:proc freq data chol9c;table race*hdl cat/cmh noprint;run;Results from the PROC FREQ statement with CMH option for race are displayed in Output 7:Output 7. Output from PROC FREQ Statement with CMH Option for RaceOutput 7 shows the Cochran-Mantel-Haenszel Statistics table of three different alternative hypotheses:nonzero correlation, row mean scores differ and general association. Information on degrees of freedom(DF), test statistics (value) and two-sided P-values (prob) are also shown. Since we are interested in apotential trend between race across HDL categories, we read the P-value for “General Association”. Thetwo-sided P-value of 0.0001 for General Association tells us that there is an overall statisticallysignificant association between race and HDL categories. Some analysts may prefer to dummy codeeach level of this multilevel categorical variable to examine if there are significant trends for a specificresponse type. In that case, the Cochran-Armitage Trend test would be used as described above sincethe dummy coded variable would thereby be binary.9

CONSIDERATIONSIn statistical hypothesis testing, we typically turn to P-values to help us decide whether our results arestatistically significant or not. However, we should approach our interpretation of P-values with caution,especially as they pertain to results of trend tests. P-values are particularly sensitive to sample size. Inlarge studies such as our example study cohort, the P-values of the statistical tests for trend are usuallysignificant (P-value 0.05). It is thus important to review all available information and consider whetherthe trends are also clinically meaningful.Finally, the guidelines presented in this paper are not meant to be steadfast rules. The intent of this paperis to provide guidance on choosing the appropriate tests for trend and understanding the resulting output.CONCLUSIONTests for trend offer another option to evaluate the presence of increasing or decreasing differences inthe distribution of dependent variables across independent ordinal categories. In SAS, we can easilyperform trend tests for continuous and categorical variables using simple procedures as described.REFERENCESCenters for Disease Control and Prevention (CDC). National Center for Health Statistics (NCHS).National Health and Nutrition Examination Survey Data. Hyattsville, MD: U.S. Department of Health andHuman Services, Centers for Disease Control and Prevention, 2009-2010. Available s/Default.aspx?BeginYear 2009. Accessed April29, 2019.SAS Institute Inc. 2011. SAS/QC 9.3 User’s Guide. Cary, NC: SAS Institute Inc.SAS Institute Inc. 2016. Base SAS 9.4 Procedures Guide: Statistical Procedures, Fifth Edition. Cary,NC: SAS Institute Inc.ACKNOWLEDGMENTSThe opinions expressed in this paper are those of the authors and do not represent the views of theUniversity of California, Irvine.RECOMMENDED READING Rosner, B. 2011. Fundamentals of Biostatistics. 7th ed. Boston, MA: Brooks/Cole, Cengage Learning. Baldi, B. and Moore D.S. 2014. The Practice of Statistics in the Life Sciences. 3rd ed. New York, NY:W.H. Freeman and Company.CONTACT INFORMATIONYour comments and questions are valued and encouraged. Contact the author at:Christina ParkUniversity of California, [email protected]@uw.eduElani StrejaUniversity of California, [email protected] and all other SAS Institute Inc. product or service names are registered trademarks or trademarks ofSAS Institute Inc. in the USA and other countries. indicates USA registration.Other brand and product names are trademarks of their respective companies.10

When creating a descriptive table, patient characteristics are the dependent variables and ordinal exposure categories are the independent variables. It is important to note that patient characteristics may come in three types: (1) continuous—parametric, (2) continuous—non-parametric, or (3) categorical (binary and more than two levels).