置信区间计算器
此计算器使用以下公式创建总体平均值的置信区间:
置信区间 = x +/- z*(s/√ n )
金子:
- x :样本平均值
- z:对应于置信水平的z值
- s:样本标准差
- n:样本量
要创建总体平均值的置信区间,只需填写下面的值,然后单击“计算”按钮:
90% 置信区间:( 5.896 , 28.104 )
95% 置信区间:( 3.770 , 30.230 )
99% 置信区间:( -0.388 , 34.388 )
function calc() {
//get input degrees of freedom, t-value var mean = document.getElementById('mean').value*1; var sd = document.getElementById('sd').value*1; var n = document.getElementById('n').value*1;
//define z-scores to use var z_90 = 1.645; var z_95 = 1.96; var z_99 = 2.576;
//calculate intervals var low_90 = mean - (z_90 * (sd/(Math.sqrt(n)))); var high_90 = mean - (-1*(z_90 * (sd/(Math.sqrt(n)))));
var low_95 = mean - (z_95 * (sd/(Math.sqrt(n)))); var high_95 = mean - (-1*(z_95 * (sd/(Math.sqrt(n)))));
var low_99 = mean - (z_99 * (sd/(Math.sqrt(n)))); var high_99 = mean - (-1*(z_99 * (sd/(Math.sqrt(n)))));
//output values document.getElementById('low90').innerHTML = low_90.toFixed(3); document.getElementById('high90').innerHTML = high_90.toFixed(3);
document.getElementById('low95').innerHTML = low_95.toFixed(3); document.getElementById('high95').innerHTML = high_95.toFixed(3);
document.getElementById('low99').innerHTML = low_99.toFixed(3); document.getElementById('high99').innerHTML = high_99.toFixed(3); }