# Options # Surpress scientific notations, digits and lines options(scipen = 999, digits = 10, max.print = 99999999) # Assignment 1 attach(DELL_DATA_cleaned) library(psych) summary(DELL_DATA_cleaned) describe(DELL_DATA_cleaned) library(naniar) vis_miss(DELL_DATA_cleaned) # Chisquare Tests prop.table(table(q14)) chisq.test(table(q14)p=c(0.55,0.45)) chisq.test(table(q14), p=c(0.55,0.45)) chisq.test(q13, SAMPLE, correct = FALSE) E<-chisq.test(q13, SAMPLE, correct = FALSE) str(E) E$expected E$expected<5 E$expected<1 chisq.test(q13, SAMPLE, correct = FALSE, simulate.p.value=TRUE, B=10000) fisher.test(table(q13, SAMPLE), workspace = 2000000) library(vcd) assocstats(table(q13, SAMPLE)) # Paired t test t.test(q5, q4, paired = TRUE, alternative = "greater") # Nonpair: wilsoxon wilcox.test(q5, q4, paired = TRUE, exact = FALSE, correct = FALSE) library(coin) wilcoxsign_test(q5 - q4, zero.method="wilcoxon", distribution="asymptotic") # Oneway ANOVA options(contrasts = c("contr.sum","contr.poly")) FIT.02<- aov(q6~ factor(q11), data = DELL_DATA_cleaned) # DELL experiment attach(DELL_EXP) FIT.02<- aov(ATT ~ OL + factor(BRAND)*factor(PRODUCT), data = DELL_EXP) summary(FIT.02) Anova(FIT.02, type=3) # Plots plot(FIT.02) attach(DELL_EXP) interaction.plot(factor(BRAND),factor(PRODUCT), ATT) FIT.03<- lm(ATT ~ OL + factor(BRAND)*factor(PRODUCT), data = DELL_EXP) summary(FIT.03)