turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- weights for ctable (classification table) in proc ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 09:42 AM

I am running proc logistic with observations weighted, as shown below.

title 'Logistic regression analysis of the dataset using backward elimination';

proc logistic data=RE_apids ;

class RACE (ref='1') FEMALE (ref='0') / param=ref;

model nir(EVENT='1')= race sex

/ selection=backward

expb /* For each parameter estimate, also display the odds ratio in the output */

fast

slentry=0.1 /* For a variable to be allow to enter the model,

a significance level of 0.1 was required (SLENTRY=0.1) */

slstay=0.05 /* For a variable to be allow to stay in the model,

a significance level of 0.05 was required (SLSTAY=0.05) */

details

lackfit

CTABLE PPROB=(0.05 TO 0.5 BY 0.05);

weight adjwgt;

run;

For my proc logistic output, I have requested a classification table. However, there are two problems.

1) Some of the cells in the classification table show values in scientific notation and I need them to be displayed in non-scientific notation. How can I do that?

2) The classification table is giving me unweighted statistics, but I need the counts displayed in the CTABLE to be weighted by the variable I provided (which is adjwgt). How can I do that? I have already specified weight adjwgt; (as you can see above) but that only affected the selection of variables for the logistic model. It didn't affect how the CTABLE calculated the overall percentage of correct predictions, sensitivity, specificity, the false positive percentage or the false negative percentage. The CTABLE is giving me all those percentages based on unweighted numbers of observations in the dataset. , ation

Accepted Solutions

Solution

01-31-2013
04:49 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 04:49 PM

This note deals generally with using different formats in results -- it uses the example of changing precision, but the general idea of saving the data with ODS OUTPUT and printing with the desired formats applies generally.

http://support.sas.com/kb/37106

Note that if your weights are sampling weights, then only the procedures whose names start with SURVEY (such as SURVEYLOGISTIC) have the necessary variance estimators to provide a proper analysis. The WEIGHT statement in PROC LOGISTIC is not appropriate for modeling survey data. That being said, the OUTROC= option provides sensitivities and specificities. You can use the ROCOPTIONS(WEIGHTED) option in the PROC LOGISTIC statement to have the weights multiply the counts as shown in the "Details: Receiver Operating Characteristic Curves: ROC Computations" section of the LOGISTIC documentation.

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 11:14 AM

I get different CTABLE results when I use WEIGHT versus when I do not use a weight. It is using the fitted logistic model to make the predictions, which depends on the weights. The procedure does not weight the actual observations, however, in the table; I don't think I would want to do that.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 12:13 PM

Yes, you will get different CTABLE results when you do not use the weight, because you will be creating an entirely different model with its own intercept, coefficients, goodness of fit, statistical significance, etc, and so the predicted probabilities shown in the CTABLE will also be different.

It is important for the data shown in the CTABLE to reflect the predictions that were made by the model for the weighted dataset.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 12:20 PM

Yes, I agree with you. That was the point I was trying to make (but probably not clearly). You *should*, and *do*, get different results with a weight versus no weight. I see no point in weighting the counts in the table.

By the way, many statisticians strongly dislike the use of stepwise variable selection procedures (including backward selection). You can find many posts on this website about this.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 12:42 PM

Regarding the scientific notation, ODS lets you control that. You could start by adding this statement just before the PROC LOGISTIC:

ODS TRACE ON;

That will show you the different pieces that ODS is generating. You may want a solution that changes the template for one of those pieces, or my preference is to use ODS to capture one of the pieces as a SAS data set. Run a PROC CONTENTS, perhaps a PROC PRINT if the piece is small enough. That would give you enough information about what to print, what formats to change, etc.

That's the overview ... time is short and I'm not sure I can commit to following up. But there are plenty of posters here who can answer questions if you have them.

Good luck.

Solution

01-31-2013
04:49 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-31-2013 04:49 PM

This note deals generally with using different formats in results -- it uses the example of changing precision, but the general idea of saving the data with ODS OUTPUT and printing with the desired formats applies generally.

http://support.sas.com/kb/37106

Note that if your weights are sampling weights, then only the procedures whose names start with SURVEY (such as SURVEYLOGISTIC) have the necessary variance estimators to provide a proper analysis. The WEIGHT statement in PROC LOGISTIC is not appropriate for modeling survey data. That being said, the OUTROC= option provides sensitivities and specificities. You can use the ROCOPTIONS(WEIGHTED) option in the PROC LOGISTIC statement to have the weights multiply the counts as shown in the "Details: Receiver Operating Characteristic Curves: ROC Computations" section of the LOGISTIC documentation.