Калькулятор теста Макнемара

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

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

h1 { color: black; text-align: center; margin-bottom: 0px; margin-top: 15px; font-family: 'Raleway', sans-serif; }

p { color: black; text-align: center; 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; }

words_text_area {

display:inline-block; color: black; font-family: Raleway; max-width: 550px; margin: 25px auto; line-height: 1.75; padding-left: 100px; }

calcTitle {

text-align: center; font-size: 20px; margin-bottom: 0px; font-family: 'Raleway', serif; }

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, input {

display: inline-block; vertical-align: baseline; width: 350px; }

#button { border: 1px solid; border-radius: 10px; margin-top: 20px;

cursor: pointer; outline: none; background-color: white; color: black; font-family: 'Work Sans', sans-serif; border: 1px solid grey; /* Green */ }

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

.label_radio { text-align: center; }

td, tr, th { border: 1px solid black; } table { border-collapse: collapse; } td, th { min-width: 40px; height: 15px; } .prob, .freq { width: 100%; display: block; }

.outcome_labels { text-align: center; background-color: #ddd; font-weight: bold; }

.outcome_labels_blank { visibility: hidden; }

.outcome_labels_header { text-align: center; background-color: #adf4eb; font-weight: bold; border-top: black 1px solid; }

.outcome_labels_header_b { vertical-align: middle; text-align: center; background-color: #adf4eb; font-weight: bold; }

words_table {

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

summary_table {

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

.label_radio { text-align: center; } Тест Макнемара используется для проверки соответствия подсчета в двух группах. Он часто используется для проверки того, равны ли подсчеты между группой лечения и контрольной группой.

Учитывая следующую таблицу 2 × 2:

Тестовая статистика X 2 вычисляется как (|bc|-1) 2 / (b+c) и соответствует распределению хи-квадрат с одной степенью свободы.

Чтобы выполнить тест Макнемара для данного набора данных, просто введите значения в ячейки ниже, а затем нажмите кнопку «Рассчитать».

|  |  |  | | --- | --- | --- | |  |  |  Тест 2  | |  |  |  Положительный |  Отрицательный | |  Тест 1 | Положительный |  |  | | Отрицательный |  |  |

//create function that performs calculations function calc() {

//get data var b1a1 = document.getElementsByClassName('b1a1')[0].innerText*1; var b1a0 = document.getElementsByClassName('b1a0')[0].innerText*1; var b0a1 = document.getElementsByClassName('b0a1')[0].innerText*1; var b0a0 = document.getElementsByClassName('b0a0')[0].innerText*1;

//calculate test statistic, p-value var chi2 = Math.pow(Math.abs(b0a1-b1a0) - 1, 2) / (b0a1-(-b1a0)); var p = 1 - jStat.chisquare.cdf(chi2, 1);

//output results document.getElementById('chi2').innerHTML = "Test statistic X2 : " + "(|" + b0a1 + "-" + b1a0 + "| - 1)2 / (" + b0a1 + "+" + b1a0 + ") = " + chi2.toFixed(5); document.getElementById('p').innerHTML = "p-value: " + p.toFixed(5);

}