How to calculate the pooled variance?

The pooled variance is a measure of the variation between two groups of data and can be calculated by taking the weighted average of the variances of each group. To calculate the pooled variance, first calculate the variance of each group, then multiply each variance by the number of data points in the group. After that, add the two results together and divide by the total number of data points in both groups. This will give you the pooled variance.

@import url(‘https://fonts.googleapis.com/css?family=Droid+Serif|Raleway’);

.axis–y .domain {
display: none;
}

h1 {
text-align: center;
font-size: 50px;
margin-bottom: 0px;
font-family: ‘Raleway’, serif;
}

p {
color: black;
margin-bottom: 15px;
margin-top: 15px;
font-family: ‘Raleway’, sans-serif;
}

#words {
color: black;
font-family: Raleway;
max-width: 550px;
margin: 25px auto;
line-height: 1.75;
padding-left: 100px;
}

#words_calc {
color: black;
font-family: Raleway;
max-width: 550px;
margin: 25px auto;
line-height: 1.75;
padding-left: 100px;
}

#words_calc input {
display: inline-block;
vertical-align: baseline;
width: 350px;
max-height: 35px;
}

#hr_top {
width: 30%;
margin-bottom: 0px;
border: none;
height: 2px;
color: black;
background-color: black;
}

#hr_bottom {
width: 30%;
margin-top: 15px;
border: none;
height: 2px;
color: black;
background-color: black;
}

#words label, #words input {
display: inline-block;
vertical-align: baseline;
width: 350px;
max-height: 35px;
}

#buttonCalc {
border: 1px solid;
border-radius: 10px;
margin-top: 20px;
padding: 10px 10px;
cursor: pointer;
outline: none;
background-color: white;
color: black;
font-family: ‘Work Sans’, sans-serif;
border: 1px solid grey;
/* Green */
}

#buttonCalc:hover {
background-color: #f6f6f6;
border: 1px solid black;
}

#words_output {
text-align: center;
}

#solution_div {
text-align: center;
}

#words_intro {
color: black;
font-family: Raleway;
max-width: 550px;
margin: 25px auto;
line-height: 1.75;
}

#words_table {
color: black;
font-family: Raleway;
max-width: 350px;
margin: 25px auto;
line-height: 1.75;
}

.text_areas {
color: black;
font-family: Raleway;
max-width: 350px;
margin: 25px auto;
line-height: 1.75;
}

.label_radio {
text-align: center;
}

When performing a , we typically assume that the variances between the two samples are equal. Under this assumption, we can calculate the to use in the two sample t-test.
To calculate the pooled variance for two samples, simply fill in the information below and then click the “Calculate” button.

Sample 1

Sample 2

Pooled variance = 59.905303

//set summary table to hidden to start
var summary_display = document.getElementById(“summary_table”);
summary_display.style.display = “none”;

//find which radio button is checked
function check() {
if (document.getElementById(‘raw’).checked) {
var table_display = document.getElementById(“words_table”);
table_display.style.display = “block”;
var summary_display = document.getElementById(“summary_table”);
summary_display.style.display = “none”;
} else {
var table_display = document.getElementById(“words_table”);
table_display.style.display = “none”;
var summary_display = document.getElementById(“summary_table”);
summary_display.style.display = “block”;
}

} //end check

//perform one-sample t-test
function calc() {
if (document.getElementById(‘summary’).checked) {
var s1 = +document.getElementById(‘s1’).value;
var n1 = +document.getElementById(‘n1’).value;
var s2 = +document.getElementById(‘s2’).value;
var n2 = +document.getElementById(‘n2’).value;

var df = n1-(-1*n2)-2;
var pooled = Math.sqrt(((n1-1)*Math.pow(s1,2) – (-1*((n2-1)*Math.pow(s2,2))))/df);
var pooled2 = pooled*pooled;

document.getElementById(‘pooled’).innerHTML = pooled2.toFixed(6);
} else {
var raw1 = document.getElementById(‘rawData1’).value.split(‘,’).map(Number);
var raw2 = document.getElementById(‘rawData2’).value.split(‘,’).map(Number);
var s1 = math.std(raw1);
var n1 = raw1.length;
var s2 = math.std(raw2);
var n2 = raw2.length;

var df = n1-(-1*n2)-2;
var pooled = Math.sqrt(((n1-1)*Math.pow(s1,2) – (-1*((n2-1)*Math.pow(s2,2))))/df);
var pooled2 = pooled*pooled;

document.getElementById(‘pooled’).innerHTML = pooled2.toFixed(6);
}

//output results
}

x