cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-184128%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ECox-Snell%20R2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184128%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ECiao%20a%20tutti%2C%3C%2FP%3E%0A%3CP%3ESto%20stimando%20una%20regressione%20logistica%20e%20ho%20bisogno%20di%20ottenere%20il%20%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%20medium%3B%22%3E%20Cox-Snell%20%3CI%3E%20R%20%3C%2FI%3E%3CSUP%3E%202%20%3C%2FSUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20si%20nasconde%20da%20qualche%20parte%20o%20devo%20calcolarlo%20manualmente%3F%20qualcuno%20ha%20a%20portata%20di%20mano%20la%20sceneggiatura%3F%3C%2FP%3E%0A%3CP%3EJMP%20mi%20fornisce%20solo%20McFadden%20e%20Nagelkerke%20per%20impostazione%20predefinita.%3C%2FP%3E%0A%3CP%3Equeste%20sono%20le%20definizioni%20che%20sto%20seguendo%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fstats.idre.ucla.edu%2Fother%2Fmult-pkg%2Ffaq%2Fgeneral%2Ffaq-what-are-pseudo-r-squareds%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fstats.idre.ucla.edu%2Fother%2Fmult-pkg%2Ffaq%2Fgeneral%2Ffaq-what-are-pseudo-r-squareds%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Egrazie!%3C%2FP%3E%0A%3CP%3ERon%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Cox-Snell%20R2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDovrai%20calcolarlo%20dai%20risultati%20presentati%20nel%20rapporto%20Test%20intero%20modello%20usando%20la%20formula%20che%20hai%20citato.%20Non%20conosco%20uno%20script%20per%20questo%20calcolo%2C%20ma%20puoi%20cercare%20nell'area%20Scambio%20file%20di%20questa%20Community.%20Non%20so%20se%20%C3%A8%20necessario%20uno%20script.%20La%20formula%20%C3%A8%20abbastanza%20semplice.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184170%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Cox-Snell%20R2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184170%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDopotutto%2C%20la%20sceneggiatura%20non%20%C3%A8%20poi%20cos%C3%AC%20male.%20Questo%20esempio%20mostra%20un%20modo%20in%20cui%20potresti%20farlo%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20to%20Here(%201%20)%3B%0A%0A%2F%2F%20example%20case%3A%20Big%20Class%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FBig%20Class.jmp%22%20)%3B%0A%0A%2F%2F%20fit%20binary%20logistic%20model%0Alr%20%3D%20dt%20%26lt%3B%26lt%3B%20Fit%20Model(%0A%20Y(%20%3Asex%20)%2C%0A%20Effects(%20%3Aage%2C%20%3Aheight%2C%20%3Aweight%20)%2C%0A%20Personality(%20%22Nominal%20Logistic%22%20)%2C%0A%20Run(%20Likelihood%20Ratio%20Tests(%201%20)%2C%20Wald%20Tests(%200%20)%20)%0A)%3B%0A%0A%2F%2F%20access%20Whole%20Model%20Test%20report%0Alr%20rep%20%3D%20(lr%20%26lt%3B%26lt%3B%20Report)%5B%22Whole%20Model%20Test%22%5D%3B%0A%0A%2F%2F%20obtain%20likelihood%20for%20reduced%20and%20full%20models%0AL%20intercept%20%3D%20Exp(%20-(lr%20rep%5BNumberColBox(1)%5D%20%26lt%3B%26lt%3B%20Get(%203%20))%20)%3B%0AL%20full%20%20%20%20%20%20%3D%20Exp(%20-(lr%20rep%5BNumberColBox(1)%5D%20%26lt%3B%26lt%3B%20Get(%202%20))%20)%3B%0AN%20%20%20%20%20%20%20%20%20%20%20%3D%20lr%20rep%5BNumberColBox(8)%5D%20%26lt%3B%26lt%3B%20Get(%201%20)%3B%0A%0A%2F%2F%20compute%20Cox-Snell%20R%20square%0Ar%20sqr%20cs%20%20%20%20%3D%201%20-%20(L%20intercept%2FL%20full)%5E(2%2FN)%3B%0A%0A%2F%2F%20copy%20original%20report%0Alabel%20%3D%20lr%20rep%5BStringColBox(2)%5D%20%26lt%3B%26lt%3B%20Insert%20Row(%202%2C%20%7B%20%22RSquare%20(C-S)%22%20%7D%20)%20%26lt%3B%26lt%3B%20Clone%20Box%3B%0Ar%20sqr%20u%20%3D%20lr%20rep%5BNumberColBox(5)%5D%20%26lt%3B%26lt%3B%20Get(%201%20)%3B%0Aaicc%20%20%20%20%3D%20lr%20rep%5BNumberColBox(6)%5D%20%26lt%3B%26lt%3B%20Get(%201%20)%3B%0Abic%20%20%20%20%20%3D%20lr%20rep%5BNumberColBox(7)%5D%20%26lt%3B%26lt%3B%20Get(%201%20)%3B%0A%0A%2F%2F%20replace%20with%20new%20report%0Alr%20rep%5BTablebox(2)%5D%20%26lt%3B%26lt%3B%20Delete%3B%0Alr%20rep%20%26lt%3B%26lt%3B%20Append(%0A%20TableBox(%0A%20%20label%2C%0A%20%20Number%20Col%20Box(%20%22%22%2C%20%7B%20r%20sqr%20u%2C%20r%20sqr%20cs%2C%20aicc%2C%20bic%2C%20N%20%7D%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184171%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Cox-Snell%20R2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184171%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%C3%88%20interessante%20che%20tutti%20i%20miei%20commenti%20siano%20scomparsi!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184172%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Cox-Snell%20R2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184172%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EGrazie%20Marco.%20funziona%20perfettamente%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Ron%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
ron_horne
Super User (Alumni)

Cox-Snell R2

Hi All,

I am estimating a logistic regression and need to get the Cox-Snell R2 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

Re: Cox-Snell R2

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 } )
	)
);

View solution in original post

3 REPLIES 3

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.

Re: Cox-Snell R2

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 } )
	)
);
ron_horne
Super User (Alumni)

Re: Cox-Snell R2

Thank you Mark. works perfect.

Ron

Recommended Articles