Turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Re: Cox-Snell R2

- 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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 6, 2019 3:04 AM
(3158 views)

Hi All,

I am estimating a logistic regression and need to get the Cox-Snell *R*^{2} is it hiding anywhere or do i have to calculate it manually? does anyone have the script handy?

JMP only gives me the McFadden and Nagelkerke by default.

these are the definitions i am following:

https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faq-what-are-pseudo-r-squareds/

thank you!

Ron

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

The script is not too bad after all. This example shows one way that you could do it:

```
Names Default to Here( 1 );
// example case: Big Class
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// fit binary logistic model
lr = dt << Fit Model(
Y( :sex ),
Effects( :age, :height, :weight ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ) )
);
// access Whole Model Test report
lr rep = (lr << Report)["Whole Model Test"];
// obtain likelihood for reduced and full models
L intercept = Exp( -(lr rep[NumberColBox(1)] << Get( 3 )) );
L full = Exp( -(lr rep[NumberColBox(1)] << Get( 2 )) );
N = lr rep[NumberColBox(8)] << Get( 1 );
// compute Cox-Snell R square
r sqr cs = 1 - (L intercept/L full)^(2/N);
// copy original report
label = lr rep[StringColBox(2)] << Insert Row( 2, { "RSquare (C-S)" } ) << Clone Box;
r sqr u = lr rep[NumberColBox(5)] << Get( 1 );
aicc = lr rep[NumberColBox(6)] << Get( 1 );
bic = lr rep[NumberColBox(7)] << Get( 1 );
// replace with new report
lr rep[Tablebox(2)] << Delete;
lr rep << Append(
TableBox(
label,
Number Col Box( "", { r sqr u, r sqr cs, aicc, bic, N } )
)
);
```

Learn it once, use it forever!

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Cox-Snell R2

You will have to calculate it from the results presented in the Whole Model Test report using the formula that you cited. I don't know of a script for this calculation, but you could search the File Exchange area of this Community. I don't know if a script is necessary. The formula is pretty simple.

Learn it once, use it forever!

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

The script is not too bad after all. This example shows one way that you could do it:

```
Names Default to Here( 1 );
// example case: Big Class
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// fit binary logistic model
lr = dt << Fit Model(
Y( :sex ),
Effects( :age, :height, :weight ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ) )
);
// access Whole Model Test report
lr rep = (lr << Report)["Whole Model Test"];
// obtain likelihood for reduced and full models
L intercept = Exp( -(lr rep[NumberColBox(1)] << Get( 3 )) );
L full = Exp( -(lr rep[NumberColBox(1)] << Get( 2 )) );
N = lr rep[NumberColBox(8)] << Get( 1 );
// compute Cox-Snell R square
r sqr cs = 1 - (L intercept/L full)^(2/N);
// copy original report
label = lr rep[StringColBox(2)] << Insert Row( 2, { "RSquare (C-S)" } ) << Clone Box;
r sqr u = lr rep[NumberColBox(5)] << Get( 1 );
aicc = lr rep[NumberColBox(6)] << Get( 1 );
bic = lr rep[NumberColBox(7)] << Get( 1 );
// replace with new report
lr rep[Tablebox(2)] << Delete;
lr rep << Append(
TableBox(
label,
Number Col Box( "", { r sqr u, r sqr cs, aicc, bic, N } )
)
);
```

Learn it once, use it forever!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Cox-Snell R2

Thank you Mark. works perfect.

Ron

Ron