I'm a little confused. I'm actually working on an assignment using SAS IML and we are supposed to recreate the analysis of variance table from using the proc GLM procedure. As part of this we are supposed to utilize GROUP_N, GROUP_MEAN, and OVERALL_MEAN variables and use the Sum of Squares model equation with these variables. However, since the SS equation requires the difference in means to be squared, this can't be done because the matrixes are not square (they are 1x5 vectors). Is there a way to get SAS to input each aspect of the column into the equation individually and then add everything together?
To provide clarity, I have a continuous dependent variable and an independent categorical variable consisting of 5 levels and am trying to use the equation:
To get sum of squares in PROC IML, you can use the ## subscript reduction operator.
ssq=y(##,); /* sum of squares down the columns */
ssq2=y(,##); /* sum of squares across the rows */
Of course, to use this in your formula, you would have to subtract off the mean first. I assume you can do that yourself.
For all of these types of sum of squares formulas, there is also an expanded formula that is equivalent and allows a different computation that doesn't specifically involved subtracting off the mean.
I assume the dot indicates the mean over the subscripted dimension. Double-dot indicates the mean over both rows and columns (the grand mean).
If Y is a matrix, then
Y_bar_doubledot = Y[:]; /* grand mean */
Y_i_dot = Y[i, :]; /* mean for the i_th row */
There is no problem with taking the squares because the expressions in the summation are scalar values for each value of i.
To get sum of squares in PROC IML, you can use the ## subscript reduction operator.
ssq=y(##,); /* sum of squares down the columns */
ssq2=y(,##); /* sum of squares across the rows */
Of course, to use this in your formula, you would have to subtract off the mean first. I assume you can do that yourself.
For all of these types of sum of squares formulas, there is also an expanded formula that is equivalent and allows a different computation that doesn't specifically involved subtracting off the mean.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →Follow along as SAS’ Robert Blanchard explains three aspects of autotuning in a deep learning context: globalized search, localized search and an in parallel method using SAS.
Find more tutorials on the SAS Users YouTube channel.