Questions tagged [contingency]
A contingency table is a non-negative integer matrix with specified row and column sums.
contingency
246
questions
0
votes
1
answer
65
views
Generate all possible contingency tables with fixed marginals; probability under independence [closed]
Is there a function in R to generate ALL possible two-way contingency tables for given marginal frequencies? This could be programmed but maybe someone already did this. The reason I'm asking is this. ...
1
vote
0
answers
20
views
Contingency table for rater data without values for one rater
I'm still learning R and I hit on a (possibly trivial???) problem quite early on.
I have data from several sets of 2 raters assigning 3 ratings (Good, Acceptable, Unacceptable) to services. I would ...
1
vote
0
answers
63
views
How to code chi-squared integrand using elementary R functions
I am attempting to write probability density function for 2x2 contingency table with given margins, using chi-squared statistics.
I am aware there are easy ways to do this with native R functions, but ...
1
vote
1
answer
124
views
How to move row group name into stubhead and center stub using gt()
I'm trying to create a contingency table using the gtsummary and gt packages in R. I have two questions that I'm hoping will correct the table I've made so far:
How can I move the row group name to ...
0
votes
0
answers
37
views
SPSS Rao-Scott chi-square when a cell is 0
We are conducting a study in which we analyze data from a survey whith a complex sampling design. Therefore, to determine if there is an association or independence between categorical variables, we ...
1
vote
1
answer
95
views
ValueError when using scipy.stats.chi2_contingency
import numpy as np
from scipy.stats import chi2_contingency
class Node_chi2:
def __init__(self, chi2, num_samples, num_samples_per_class, predicted_class):
self.chi2 = chi2
self....
1
vote
1
answer
50
views
PowerQuery pivot data table sideways
I would like to do table/contingency table from a table which have these data:
A 1
B 1
C 1
A 2
C 2
C 3
to have a contingency table/table like this:
A 1 2
B 1
C 1 2 3
and so on
I tried with power ...
0
votes
0
answers
22
views
Contingency Tables in R [duplicate]
Does anyone have advice on how to create a contigency table in R? For reference, I have one categorical variable (let us call this financial class) and then one outcome variable, coded as binary (0/1) ...
0
votes
0
answers
208
views
ImportError: cannot import name 'odds_ratio' from 'scipy.stats.contingency'
I'm trying to import the odds_ratio function from scipy.stats.contingency, but when I input the following:
from scipy.stats.contingency import odds_ratio
I get the error message:
ImportError: cannot ...
0
votes
1
answer
269
views
How do I completely exclude a variable category in R using subset or any other function?
I'm trying to create a contingency table to perform a chi square test. I have a variable (group) with 3 categories (N, Y, Unknown) - I want to exclude one of these categories (Unknown) which has very ...
0
votes
0
answers
10
views
Analyzing 3-point data where the variables are independent from one another
I am novice when it comes to data analysis, though I find myself doing it a lot. I apologize if this question has a simple answer that I am not seeing.
I have a frequency table of medical ...
0
votes
2
answers
87
views
How do I create a contingency table of overlapping categories?
I have this dataframe:
structure(list(`Product Name` = c("Apple", "Banana", "Cherry", "Date", "Elderberry", "Fig", "Guava", "...
0
votes
1
answer
161
views
Add column and row percentage to contingency table
I'm trying to add the column and row percentage (simultaneously) to a contingency table.
I tried something like this:
library(tidyverse)
library(janitor)
mtcars %>%
tabyl(gear, cyl) %>%
...
1
vote
1
answer
62
views
Julia function for conditional proportions given margins of multi-dimensional array
I am new to Julia and looking for a function to compute the proportions of multidimensional array give some dimensions as margin. Basically, it is dividing each element of the array by the sum of ...
1
vote
1
answer
67
views
Perform Action to all possible combinations of columns
I´m new to R so forgive me if the question is quite mundane.
I have a table with categorical variables as columns. I need to calculate the contingency coefficient between every possible combination of ...