02-19-2014 12:23 PM
I am a new SAS user, and I'm trying to use GLMSELECT to select a best model for my data. I want to calculate Akaike weights for each candidate model to average parameter estimates for a best fit model, but in order to do this I need to get a table of estimated parameters for all of my candidate models with AICC displayed for each model. I hope that makes sense.
I can get a very long output that shows each model separately, but I would have to manually enter the parameter estimates into a separate table, which would be extremely time consuming. I tried using the TABLES option in the MODELAVERAGE statement to get this table, but I haven't figured out a way to do that.
I can get this information easily from R, but the analysis in R is actually giving me slightly different results from SAS (for reasons I can't determine right now), so I'd like to stick with SAS and get that table from SAS. Any help would be much appreciated. Thanks!
02-19-2014 12:43 PM
Let's start off with a disclaimer: I have never done this, so what I am suggesting may only be possible in my mind.
I think you will need to use ODS OUTPUT to get all of the information. The experimental MODELAVERAGE statement does a bootstrap to average, without weighting. So, you will need to pull from several ODS tables to get the information you want. So ODS TRACE ON before, ODS TRACE OFF after to identify exactly which tables carry the variables you need for re-arranging into the table you are looking for.
02-19-2014 03:14 PM
Thanks for the tip. I was able to use that to get the parameter estimates, but I'm still working on getting the AICC for each model into that table. I'm new at this, so the ODS output is kind of confusing. I will let you know if I work it out. Thanks again!
02-21-2014 01:55 PM
I could provide more information if I knew what options you were using, but see if this example helps you head in the right direction:
ods output SelectionSummary = Summary ParameterEstimates = PE;
proc glmselect data=sashelp.baseball;
model logSalary = nAtBat nHits nHome nRuns nRBI nBB
yrMajor crAtBat crHits crHome crRuns crRbi
crBB nOuts nAssts nError
merge Summary PE(where=(Step^=.));
proc print data=All;
var Step Effect Estimate AICC;
02-23-2014 03:45 PM
OKAY, I'm being an idiot (I think!). In stepwise selection I cannot get an AICC value for all possible models, because SAS is building the model in a stepwise fashion. I can only get AICC for each step. Sorry about that. I'm working on using PROC REG to get all possible models and their AICC values, but I'm having issues there as PROC REG does not have a class statement, and I do have several categorized variables. I might end up asking for help on that in a separate thread. Thanks to both of you though--that code did get me AICC in a table for each step and I might end up using it if I stick with stepwise selection.
02-24-2014 08:39 AM
Stop and think this over. An all possible models approach that includes categorical models has an inherent drawback in that a variable that is (for instance) dichotomous would be represented with one variable, but any that have more than two levels (say N) will be represented by N-1 variables that are exclusive. You then run into the problem of trying to interpret a model that only includes <N-1 of these indicator variables.
02-27-2014 04:52 PM
Right. My dichotomous variables are basically on a size scale, with small=0 and large=1, and there are only two categories, so I think I will be able to interpret the models, but thanks for pointing that out.