Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Level I

## need help in creating formula for CKD-EPI equation

I created the one mentioned below, but is somehow erroneous.

``````141 * Choose(
(:Creat / :k) ^ If( :Sex == F/*###*/,
-0.329,
-0.411
) < 1,
1
) * Choose( (:Creat / :k) ^ (-1.209) > 1, 1 ) * 0.993
^ :Age * If( :Sex == F, 1.018, 1 ) *
If( :Race == B, 1.159, 1 )``````

6 REPLIES 6
Highlighted
Community Manager

## Re: need help in creating formula for CKD-EPI equation

It's hard to tell without more context, especially the error message that you're receiving, but I think you probably need to put your sex and race constants in quotes in the comparisons.

``````141 * Choose(
(:Creat / :k) ^ If( :Sex == "F",
-0.329,
-0.411
) < 1,
1
) * Choose( (:Creat / :k) ^ (-1.209) > 1, 1 ) * 0.993
^ :Age * If( :Sex == "F", 1.018, 1 ) *
If( :Race == "B", 1.159, 1 )``````
-Jeff
Highlighted
Staff

## Re: need help in creating formula for CKD-EPI equation

I don't think you understand the Choose() function. It evaluates its first argument and uses it as an index (1, 2, ..., N) to the argument to evaluate and return. Your first call has only 2 arguments. Would you expect the first argument to evaluate to an integer value starting at 1?

What are you trying to calculate? Can you show an equation?

Learn it once, use it forever!
Highlighted
Level I

## Re: need help in creating formula for CKD-EPI equation

GFR = 141 × min(Scr/κ, 1)α × max(Scr/κ, 1)-1.209 × 0.993Age × 1.018 [if female] × 1.159 [if black]

where:
Scr is serum creatinine in µmol/L,
κ is 61.9 for females and 79.6 for males,
α is -0.329 for females and -0.411 for males,
min indicates the minimum of Scr/κ or 1, and
max indicates the maximum of Scr/κ or 1

Highlighted
Level I

## Re: need help in creating formula for CKD-EPI equation

``````141 * Choose( :Creat / :Name( "k (CKD EPI CONSTANT) F= 0.7, M=0.9" ) < 1, 1 ) ^ If(
:Name( "k (CKD EPI CONSTANT) F= 0.7, M=0.9" ) == 0.7,
-0.329,
-0.411
) * Choose( :Creat / :Name( "k (CKD EPI CONSTANT) F= 0.7, M=0.9" ) > 1, 1 ) ^ (-1.209) * 0.993 ^ :Age *
If( :Name( "k (CKD EPI CONSTANT) F= 0.7, M=0.9" ) == 0.7,
1.018,
1
) * If( :Name( "RACE BLACK = 1, REST = 0" ) == 1,
1.159,
1

)``````

I did modify the code and it works, but my values do not match the ones using an online calculation. My formula is over-estimating the GFR.

Highlighted
Level I

## Re: need help in creating formula for CKD-EPI equation

Since I am using mg/dl, k= 0.7 and 0.9 for Female and male respectively

Highlighted
Staff

## Re: need help in creating formula for CKD-EPI equation

``GFR = 141*Min(Scr/κ, 1)*α*Max(Scr/κ, 1) - 1.209*0.993*Age*If(:Name("RACE BLACK")==1,1.159,1)*If(:Sex=="F", 1.018, 1);``
Learn it once, use it forever!
Article Labels

There are no labels assigned to this post.