Performing Fisher's Exact Test for independence between Party and Affected Binary...
Fisher's Exact Test Results:
Fisher's Exact Test for Count Data
data: party_affected_table
p-value = 0.09973
alternative hypothesis: two.sided
Fisher's Exact Test results saved to output/fisher_test_results.txt
Computing Pearson correlation between Party and Count...
Pearson Correlation Results:
Pearson's product-moment correlation
data: congress$Party_numeric and congress$Count_Normalized
t = -0.88727, df = 537, p-value = 0.3753
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.12232132 0.04634494
sample estimates:
cor
-0.0382607
Correlation results saved to output/correlation_party_count.txt
Fitting Logistic Regression Model...
Logistic Regression Summary:
Call:
glm(formula = Count_Binary ~ Region + Age + Sex, family = "binomial",
data = congress)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.64770 1.05668 0.613 0.5399
RegionNortheast -0.13834 0.71056 -0.195 0.8456
RegionSouth 0.63629 0.57897 1.099 0.2718
RegionWest -0.44432 0.66017 -0.673 0.5009
Age -0.04127 0.01811 -2.279 0.0227 *
SexM -4.45985 1.03202 -4.321 1.55e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 207.77 on 532 degrees of freedom
Residual deviance: 139.86 on 527 degrees of freedom
(6 observations deleted due to missingness)
AIC: 151.86
Number of Fisher Scoring iterations: 8
Logistic Regression summary saved to output/logistic_model_summary.txt
Performing Chi-Square Test...
Pearson's Chi-squared test with simulated p-value (based on 2000
replicates)
data: party_affected_table
X-squared = 4.8116, df = NA, p-value = 0.07596
Chi-Square Test results saved to output/chi_square_test_results.txt
Summary Interpretation:
Key Findings:
- Fisher's Exact Test highlights the relationship between Party and Affected Binary.
- Pearson correlation evaluates normalized count relationships.
- Logistic regression examines predictors for binary outcomes.
Summary interpretation saved to output/interpretation.txt
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table
X-squared = 55.111, df = 1, p-value = 1.139e-13
Fisher's Exact Test for Count Data
data: contingency_table
p-value = 2.552e-13
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
11.27797 2866.28503
sample estimates:
odds ratio
70.25208
95% Confidence Interval for Odds Ratio:
[1] 11.27797 2866.28503
attr(,"conf.level")
[1] 0.95