Chapter 5 SAS- 1 -Chapter 5 Correlation and Regression Analysis In this chapter, we will introduce how to compute correlation and perform regression analysis.5.1 Correlation 1.PROC CORR (BASE SAS) a.Finds the estimated correlation between variables. Usually, correlation is denoted by “r”.i.-1≤r ≤1 ii.Closer to 1, the stronger the positive relationship (as X ↑, Y↑) iii.Closer to -1, the stronger the negative relationship (as X ↑, Y↓) iv.Closer to 0, the weaker the relationship between X and Y b.The formula for the estimated Pearson correlationis: c.Options in the PROC CORR linei.Different types of correlations can be found. By default, Pearson correlation statistics are computed from observations with nonmissing values for each pair of analysis variables. we will only discuss the Pearson correlation ii.COV– finds the covariance matrix iii.OUTP=___- creates a data set containing the Pearson correlations d.VAR statement – put variables of interest here2.A simple example Let us revisit the SASDATA.Adjcereal data set. We would like to find the correlations among the nutrition variables *Find the correlation matrix using PROC CORR; title2 'Correlations among the nutrition variables'; proccorrdata=sasdata.Adjcereal outp=out_set1; var sugar fat sodium; run;
has intentionally blurred sections.
Sign up to view the full version.
Chapter 5 SAS- 2 -Correlations among the nutrition variables The CORR Procedure 3 Variables: sugar fat sodium Simple Statistics Variable N Mean Std Dev Sum sugar 40 0.28942 0.14956 11.57662 fat 40 0.03218 0.02769 1.28731 sodium 40 5.61470 2.46253 224.58815 Simple Statistics Variable Minimum Maximum sugar 0 0.55556 fat 0 0.09259 sodium 0 10.71429 Pearson Correlation Coefficients, N = 40 Prob > |r| under H0: Rho=0 sugar fat sodium sugar 1.00000 0.23972 -0.16357 0.1363 0.3132 fat 0.23972 1.00000 -0.06614 0.1363 0.6851 sodium -0.16357 -0.06614 1.00000 0.3132 0.6851 a.Interpretation of the output: i.The estimated correlation between sugar and fat is r = 0.23972. ii.The p-value for a hypothesis test of Ho: Population correlation = 0 (no correlation) Ha: Population correlation ≠0 (positive or negative correlation) is 0.1363.Thus, do not reject Ho. There is not enough evidence to conclude a significant correlation between sugar and fat. b.Print of the data out_set1: