English

# Coefficient of Variation Calculator in Javascript

Coefficient of variation is represented as the ratio of the standard deviation to the mean . It is also know as unitized risk. This calculator helps to find out the coefficient of variation for set of numbers.

# Features

• Online statistics tool to compute coefficient of variation for set of data.
• This is free javascript calculator.
• Fully customizable and mobile friendly calculator.
• It works on all modern browsers.

# Preview

## Coefficient of Variance (CV) Calculator

Javascript Code

<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<html>
<title>Coefficient of Variation (CV) Calculator in Javascript </title><script type="text/javascript">
function checnum(as)
{var i;var a = as.value;as.value = a.replace(/[^\d,]/g, '');
}
function trimExtraComma(obj)
{var utext =obj.value.trim();
var firstChar = utext.substring(0, utext.length);
if(firstChar == ','){utext = utext.substring(1);}obj.value = utext.replace(/,+(?=,)/g,'');var val=document.getElementById("rvalue").value;var rary=val.split(",");var i;var k=rary.length;
for (i=0; i<k; i++){
if(rary[i].length>10) {
va='';
document.getElementById("rvalue").value =" ";va.replace(va,'');}}
}
function error()
{var t=document.getElementById("rvalue").value;
if (t!='') {
t = t.replace(" ","");var rarray=t.split(",");var k=rarray.length;
var sum=0;//Mean calculationfor(var c=0; c<k; c++){sum = sum + parseFloat(rarray[c]);}
mean = sum/k;//Variance calculation
var variance=0;var b;var varian;for(var a=0; a<k; a++)
{variance = variance+Math.pow((parseFloat(rarray[a])-mean),2);b = k-1;varian = variance/b;}//Standard Deviation Calculationvar sd=0;sd = Math.sqrt(varian); var coev = Math.round(100000 * (sd / mean)) / 100000;document.getElementById("evalue").value = coev;}
}
function chk(){
var sds = document.getElementById('dum');
if(sds == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");
document.getElementById("maindiv").style.visibility="hidden";
}
var sdss = document.getElementById("dumdiv");
if(sdss == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");}
}
</script>
<style>
h2 {border-bottom: 1px solid #ebebeb;color: #474747;font-size: 1.6em;font-weight: normal;line-height: 130%;
}
.frms
{
margin:0 auto;
font-family:Tahoma, Geneva, sans-serif;
color:#333;
font-size:.9em;
line-height:1.2em;
}
{
width:99%;
background:#fff;
border:#ddd 1px solid;
margin-top:5px;
margin-bottom:15px;
height:35px;
}
.frms input:hover,textarea:hover,select:hover
{
}
.frms input:focus,textarea:focus,select:focus
{
-webkit-box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
-moz-box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
border:#9d9983 1px solid;
}
.frms input[type="submit"],input[type="reset"],input[type="button"],button,.yellow_button,.blue_button
{
font-weight:bold;
color:#fff;
cursor:pointer;
margin:10px 0;
border:none;
}
.frms input[type="submit"]
{
background:#75ab22;
border-bottom:#629826 3px solid;
}
.frms input[type="reset"]
{
background:#ee765d;
border-bottom:#d95e44 3px solid;
}
input[type="button"],button,.blue_button
{
background:#468cd2;
border-bottom:#3277bc 3px solid;
}
.frms label
{
font-size:1.2em;
}
.resp_code
{
margin:5px 10px 10px 300px;
font:normal 1em/1.3em Tahoma, Geneva, sans-serif;
color:#333;
background:#f8f8f8;
border:#ddd 1px solid;
overflow:auto;width:50%;
}
@media screen and (max-width: 480px)
{
.resp_code
{width:auto !important;margin:0px !important;
}
}
</style>
<div id='maindiv' class='frms'><div align='center'><h2>Coefficient of Variance (CV) Calculator</h2></div>
<form name=first class='frms noborders'>
</div>
<div class='result'><div align='left'>
<label>Coefficient of Variation (CV)</label><input type=text id=evalue readonly>
</div>
</div>
</form>
</div>
</div>
</body>
</html>

• Release Date - 16-04-2015
• For customization of this script or any script development, mail to support@hscripts.com

# Usage

• Copy and paste the code into your HTML page to use this coefficient of variation calculator.
• Enter set of numbers separated by comma and click calculate to find the results.
• Copy the calculator code inside the script tag and place it where you need to integrate the Coefficient of Variation Calculator in your web page.