cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

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%3EHola%20a%20todos%2C%3C%2FP%3E%0A%3CP%3EEstoy%20estimando%20una%20regresi%C3%B3n%20log%C3%ADstica%20y%20necesito%20obtener%20el%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%20%C2%BFEst%C3%A1%20escondido%20en%20alg%C3%BAn%20lugar%20o%20tengo%20que%20calcularlo%20manualmente%3F%20%C2%BFAlguien%20tiene%20el%20gui%C3%B3n%20a%20mano%3F%3C%2FP%3E%0A%3CP%3EJMP%20solo%20me%20da%20McFadden%20y%20Nagelkerke%20por%20defecto.%3C%2FP%3E%0A%3CP%3EEstas%20son%20las%20definiciones%20que%20estoy%20siguiendo%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%3E%C2%A1gracias!%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%3ETendr%C3%A1%20que%20calcularlo%20a%20partir%20de%20los%20resultados%20presentados%20en%20el%20informe%20de%20la%20prueba%20del%20modelo%20completo%20utilizando%20la%20f%C3%B3rmula%20que%20cit%C3%B3.%20No%20conozco%20un%20script%20para%20este%20c%C3%A1lculo%2C%20pero%20puede%20buscar%20en%20el%20%C3%A1rea%20de%20intercambio%20de%20archivos%20de%20esta%20comunidad.%20No%20s%C3%A9%20si%20es%20necesario%20un%20gui%C3%B3n.%20La%20f%C3%B3rmula%20es%20bastante%20simple.%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%3EEl%20gui%C3%B3n%20no%20es%20tan%20malo%20despu%C3%A9s%20de%20todo.%20Este%20ejemplo%20muestra%20una%20forma%20en%20que%20puedes%20hacerlo%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%C2%A1Es%20interesante%20que%20todos%20mis%20comentarios%20hayan%20desaparecido!%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%3EGracias%20Mark.%20funciona%20perfecto%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