I have data about children and mental health. I need help with this simple contingency table.
I thought it may be due to NA on my sample, but I did named NA = NA
when I imported my data. So I don’t know what I did wrong.
my data:
# contingency table 1
tabela <- table(data_adhd$tdah_tipo, data_adhd$traumas_adversidades)
print(tabela)
# chi squared test
chisq.test(tabela, correct = F)
I thought that needed the correction because of my small number of participants.
the console:
> # contingency table 1
> tabela <- table(data_xxxx$yyyy_tipo, data_xxxx$zzzz)
> print(tabela)
NA no yes
type1 1 7 16
type2 0 17 11
# chi squared test
> chisq.test(tabela, correct = F)
Pearson's Chi-squared test
data: tabela
X-squared = 5.8193, df = 2, p-value = 0.05449
warning message:
In stats::chisq.test(x, y, ...) :
Chi-square approximation may be incorrect
observations:
The p value should be 0,0311.
How can i add the p value in a geombar grafic in a simple way?
user26842578 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2