Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Chi-squared tests of independence [Musculoskeletal injuries treated]
X <- matrix(c(58,81,61,42,19,39),ncol=3,byrow=TRUE) # create table colnames(X) <- c("Acetaminophen","Ibuprofen","Codeine") rownames(X) <- c(" Significant Improvement"," Slight Improvement") X <- as.table(X) X df = (nrow(X)-1)*(ncol(X)-1) alpha = 0.1 RS = rowSums(X) # sum of rows E1 = c(colSums(X)*RS[1]/sum(X)) # Expected frequencies of Significant Improvement E2 = c(colSums(X)*RS[2]/sum(X)) # Expected frequencies of Slight Improvement x1 = sum((X[1,]-E1)^2/E1) x2 = sum((X[2,]-E2)^2/E2) X2 = x1 + x2 pv = pchisq(X2,df,lower.tail=FALSE) cv = qchisq(alpha,df,lower.tail=FALSE) X2 # Chi-squared df # degree of freedom pv # p-value cv # critical value # Make a conlusion if(X2 > cv){ print("There is enough statistical evidence to REJECT the null hypothesis and to believe that there is a relationship between the treatment and response.") }else { print("There is not enough statistical evidence to reject the null hypothesis and to believe that there is no relationship between the treatment and response.") }
run
|
edit
|
history
|
help
0
Ex15-12
R1
MAX
Paired t-test [ Zinc Concentration]
R functions
waves 2
Snowflake curve
23-09-2020InterpolaçãoNewtonform
Monroe Week 9 Homework
Linear regression Model [Empirical Models]