Skip to main content

Posts

Showing posts from August, 2018

DANDA - A macro collection for easier SAS statistical analysis

Objective :  You are running ANOVAs or regressions in SAS, and wish there was a way to avoid writing the dozens of commands needed to conduct the analysis and generate recommended diagnostics and summary of results, not to mention the hundreds of possible options that might be needed to access recommended methods.  A possible solution is to download a copy of danda.sas below, and use this macro collection to run the dozens of commands with one statement.  We will also have future posts covering various uses of danda.sas, giving examples as always. danda.sas is under continued development, check this page for updates. Date                       Version               Link 2021/03/15             2.12.030          danda.sas 2021/03/15             2.12                UserManual.pdf     2012/08/30                 2.11                danda211.sas Example :  You have an RBD split-plot design, so typical SAS code for mixed model ANOVA is proc mixed data=one;   class block treat week;   m

Why are my degrees of freedom wrong?

Objective :  You are running a linear model, for example ANOVA or regression, and are using the "ANOVA table" to decide which terms in the model are influencing the dependent variable.  You check the numerator and denominator degrees of freedom, as recommended , to guard against modeling errors and use of wrong error terms.  Reported values disagree with what you expected, so now what? Make sure your expected numbers are calculated correctly : An example model is (last term is the residual error) [Model 1]       y = u + block + treat + block*treat + rep(block*treat) If numbers of levels are b=2 for blocks, t=2 for treats, and r=5 for reps, then we expect degrees of freedom (DF) to be DF[block] = b-1 = 1 DF[treat] = t-1 = 1 DF[block*treat] = (b-1)*(t-1) = 1*1 = 1 DF[rep(block*treat)] = (r-1)*(b)*(t) = 4*2*2 = 16 Number of observations is b*t*r = 20, and DF add to 19, which is 20 minus the one DF for the intercept, as expected. DF rules are: 1) DF for single factor