flen
12-16-2003, 09:48 AM
hello people,
I hope you will give me a little time to explain my problem to you.
I am a phycisian doing research in Rheumatology, who wants to build a webcalculator that calculates a patients disease activity score from clinical variables, like number of painfull joints and laboratory values. The formula has recently been developed and validated. When I try to incorporate it in a javascript webcalculator something goes wrong. The calculated values are higher than they should be.
this is the formula:
DAS28 (the name of the score) = 0.56*sqrt(A) + 0.28*sqrt(B) + 0.36*ln(C+1) + 0.014*D+ 0.96
I use a natural logarithm in the formula and the problem must be related to it, I think.
I have incorporated it into an existing javascript source and this is as far as I got:
<script language="JavaScript">
<!--
function round(number,x)
{x = (!x ? 2 : x);
return Math.round(number*Math.pow(10,x))/Math.pow(10,x);}
function calc (form)
{form.das28.value = round(0.555*(Math.sqrt(form.A.value))+0.284*(Math.sqrt(form.B.value))+Math.log((form.C.value)+1.0)*0 .36+form.D.value*0.0142+0.96)}
//-->
</script>
Fil in any number of A, B, C or D and this javascript calculates a number that is too high, except when C is zero. So I think I mistranslated the natural logarithm term (but I was ensured it has to be <log> instead of <ln>, is this correct?)
Hopefully this makes sense to anyone. I am an autodidact regarding webdesign/developement and its is probably a small problem that I cant solve because im am lacking the knowlegde of javascript, but I'm really on a dead end here. Hopefully some of you will give it some time and give me some suggestions/ideas on how to solve this.
Many thanks in advance,
Marcel Flendrie
(ps for examples of working webcalculators check out the website http://www.das-score.nl/www.das-score.nl/index.html)
I hope you will give me a little time to explain my problem to you.
I am a phycisian doing research in Rheumatology, who wants to build a webcalculator that calculates a patients disease activity score from clinical variables, like number of painfull joints and laboratory values. The formula has recently been developed and validated. When I try to incorporate it in a javascript webcalculator something goes wrong. The calculated values are higher than they should be.
this is the formula:
DAS28 (the name of the score) = 0.56*sqrt(A) + 0.28*sqrt(B) + 0.36*ln(C+1) + 0.014*D+ 0.96
I use a natural logarithm in the formula and the problem must be related to it, I think.
I have incorporated it into an existing javascript source and this is as far as I got:
<script language="JavaScript">
<!--
function round(number,x)
{x = (!x ? 2 : x);
return Math.round(number*Math.pow(10,x))/Math.pow(10,x);}
function calc (form)
{form.das28.value = round(0.555*(Math.sqrt(form.A.value))+0.284*(Math.sqrt(form.B.value))+Math.log((form.C.value)+1.0)*0 .36+form.D.value*0.0142+0.96)}
//-->
</script>
Fil in any number of A, B, C or D and this javascript calculates a number that is too high, except when C is zero. So I think I mistranslated the natural logarithm term (but I was ensured it has to be <log> instead of <ln>, is this correct?)
Hopefully this makes sense to anyone. I am an autodidact regarding webdesign/developement and its is probably a small problem that I cant solve because im am lacking the knowlegde of javascript, but I'm really on a dead end here. Hopefully some of you will give it some time and give me some suggestions/ideas on how to solve this.
Many thanks in advance,
Marcel Flendrie
(ps for examples of working webcalculators check out the website http://www.das-score.nl/www.das-score.nl/index.html)