Need help trying to figure some logic fro a websit

# Thread: Need help trying to figure some logic fro a websit

1. Senior Member
Join Date
Dec 1969
Posts
120

## Need help trying to figure some logic fro a websit

http://www.sfar.org/scores2/mpm_cancer2.html<BR><BR>This is a site which has a scoring system and i had recreate locally because i have to store the values in our database. At the bottom right hand is the total(Logit on website). I can&#039;t for the life of me figure out the logic they used. I went into the source code and it confused me more. If anyone could help i&#039;d appreciate it. If you want u can plugin your own numbers if it makes it easier. Any help will do!!! <BR>Thanks in advance.

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Need help trying to figure some logic fro a we

It says how they do it:<BR><BR>Logit = Sum ( values * beta) + 0.21935 ln( days+ 0.5) -0.43417<BR>Predicted death rate = e(logit) / ( 1 + e (Logit) )<BR><BR>Seems pretty straight-forward to me...<BR><BR>Craig.

3. Senior Member
Join Date
Dec 1969
Posts
120

## RE: Need help trying to figure some logic fro a we

Right but have u tried to do it, it doesn&#039;t add up or what does "0.21935 In(days + .05)-.43417" mean? The "In"? and are they referring to "number of days before ICU" for "(days+.05)" and are they multiplying "-.43417" or subtracting? Looks straight forward until you start putting numbers or try to figure the answer out so i can implement it formula in my project.

4. Senior Member
Join Date
Dec 1969
Posts
3,195

## RE: Need help trying to figure some logic fro a we

You have their actual JS functions. Just do a &#039;View Source&#039; and you&#039;ll see them.<BR><BR>&#060;SCRIPT LANGUAGE=javascript&#062;function CalcRCP(form) {<BR>form.zrcp.value = form.rcp[form.rcp.selectedIndex].value<BR>form.zrcp.value = CalcRcp(form)<BR>form.zmort.value = CalcMort(form)<BR><BR>etc..........

5. Senior Member
Join Date
Dec 1969
Posts
16,931

## Not "IN", "ln".

That&#039;s "L" "N". ln. A mathematical term. From memory it&#039;s a log with base e (where e is another mathematical term).<BR>http://www.google.com/search?hl=en&lr=&ie=UTF-8&c2coff=1&q=define%3Aln&btnG=Search<BR>You want " Natural Log - a logarithm, where a = 2.718 282... (a transcendental number), usually denoted loge x, or ln x.".<BR><BR>Logit = Sum ( values * beta) + 0.21935 ln( days+ 0.5) -0.43417<BR>Predicted death rate = e(logit) / ( 1 + e (Logit) )<BR><BR>The rest is pretty straight maths... If there&#039;s no "*" then you have to assume it&#039;s minus "0.43417", not multiplied by minus. Except for the implied multiplication between 0.21935 and the ln of (days +0.5). In fact, it can&#039;t be multiplied by that negative number - logit seems to be a positive number.<BR><BR>Craig.

6. Senior Member
Join Date
Dec 1969
Posts
120

## RE: Not

OK so:<BR>Logit = Sum ( values * beta) + 0.21935 ln( days+ 0.5) -0.43417<BR><BR>Should look like this? If you leave all drop boxes on website to blank and beta would be &#039;0&#039; until you get to &#039;SBP&#039;.<BR><BR>Logit = Sum(-1.97532) + 0.21935(i assume multiply)ln(2.718282)*(days(0) + .05)-.43417<BR><BR>Logit = .672831082177<BR><BR>According to the website it should be -2.561531.

7. Senior Member
Join Date
Dec 1969
Posts
96,118

## Yeah, but the LN function...

...doesn&#039;t exist in VBScript. Look in the docs:<BR>http://msdn.microsoft.com/library/en-us/script56/html/vbscripttoc.asp<BR><BR>Look at the functions available in VBS.<BR><BR>Read the description of the LOG function.<BR><BR>Enough said?<BR><BR>But there is also no SUM function in VBScript.<BR><BR>So *probably* this is a function they are using in a SQL query???<BR><BR>Or are they looping through some array to get the sum?<BR><BR>BUT WAIT A MINUTE! <BR> LN( 2.718182 )<BR>is *1* !!!<BR><BR> 2.718281828 *is* the value of E, the root of the natural logarithms.<BR><BR>And BY DEFINITION, LN(E) is 1.0 <BR><BR>So something there makes no sense.<BR><BR>

8. Senior Member
Join Date
Dec 1969
Posts
96,118

## Yeah, but the LN function...

...doesn&#039;t exist in VBScript. Look in the docs:<BR>http://msdn.microsoft.com/library/en-us/script56/html/vbscripttoc.asp<BR><BR>Look at the functions available in VBS.<BR><BR>Read the description of the LOG function.<BR><BR>Enough said?<BR><BR>But there is also no SUM function in VBScript.<BR><BR>So *probably* this is a function they are using in a SQL query???<BR><BR>Or are they looping through some array to get the sum?<BR><BR>BUT WAIT A MINUTE! <BR> LN( 2.718182 )<BR>is *1* !!!<BR><BR> 2.718281828 *is* the value of E, the root of the natural logarithms.<BR><BR>And BY DEFINITION, LN(E) is 1.0 <BR><BR>So something there makes no sense.<BR><BR>

9. Senior Member
Join Date
Dec 1969
Posts
96,118

## Man, where did you come up with...

...that 2.71828 stuff???<BR><BR>The web page shows the formula:<BR><BR>Logit = Sum ( values * beta) + 0.21935 ln( days+ 0.5) -0.43417<BR><BR>So the first thing you have to do is go through all the eleven Value/Beta pairs, multiplying them together and geting a sum.<BR><BR>And then:<BR><BR>Logit = TheSum + 0.21935 * LOG( days+ 0.5) - 0.43417<BR><BR>

10. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Man, where did you come up with...

He read my definition of "ln" and assumed he had to put the value of e inside the ln function, for some reason.<BR><BR>Not quite sure where he lost the "days" side of things though.<BR><BR>It&#039;s late over here, hence the reason I didn&#039;t answer him earlier.<BR><BR>Craig.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•