i'm calculating the probability of a person to have hypertension. . .
letterrs A-H stands for kasarian,weight, heredity, exercise, softdrink, likor, smoke, pork... accordingly ... i need to submit my system the very next week...
hope can get answers from you ASAP guys!! thanks in advance... God bless..
10-12-2012, 09:05 AM
xelawho
I'm guessing that you would make user inputs, get their values, assign them to variables A8 to H8, place that line of code, then output probability to the page
what are you stuck on?
10-16-2012, 08:45 PM
bleaze
function calculate()
{
var ka = parseFloat(document.hyp_frm.kasarian.value);
var wt = parseFloat(document.hyp_frm.weight.value);
var he = parseFloat(document.hyp_frm.heredity.value);
var ex = parseFloat(document.hyp_frm.exercise.value);
var so = parseFloat(document.hyp_frm.softdrink.value);
var li = parseFloat(document.hyp_frm.likor.value);
var sm = parseFloat(document.hyp_frm.smoke.value);
var po = parseFloat(document.hyp_frm.pork.value);
if (document.hyp_frm.kasarian.value == "0") {ka = ka * (1.37);}
if (document.hyp_frm.weight.value == "0") {wt = wt * (-2.578);}
if (document.hyp_frm.heredity.value == "0") {he = he * (-0.568);}
if (document.hyp_frm.exercise.value == "0") {ex = ex * (0.987);}
if (document.hyp_frm.softdrink.value == "0") {so = so * (0.987);}
if (document.hyp_frm.likor.value == "0") {li = li * (1.205);}
if (document.hyp_frm.smoke.value == "0") {sm = sm * (-1.795);}
if (document.hyp_frm.pork.value == "0") {po = po * (-0.645);}
pro="1/1+(EXP((1.059)-(1.37 * ka)+(-2.578 * wt)+(-0.568*he)+(0.987*ex)+(0.987*so)+(1.205*li)+(-1.795*sm)+(-0.645*po)))";
document.getElementById(sub3).value=pro;
}
This is the code i'm using and it simply didnt work....
I guess the problem is in the exponent(EXP)...do you have any idea how to make it work?
10-17-2012, 12:46 PM
JMRKER
Modified in next post
10-17-2012, 01:05 PM
JMRKER
Assuming it is the natural logarithm you are trying to convert from Excel,
the equivalent javascript command would be log() and/or pow().
See: http://www.w3schools.com/jsref/jsref_log.asp