Two Sample T-test Continued

MJ<-read.csv("Marihuana.csv",header=T) attach(MJ) model <- aov(DSST~Group) To get all plots on one graph par(mfrow=c(2,2)) plot(model) names(model) [1] "coefficients" "residuals" "effects" "rank" [5] "fitted.values" "assign" "qr" "df.residual" [9] "contrasts" "xlevels" "call" "terms" [13] "model" model\$fitted.values 1 2 3 4 5 6 7 8 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 9 10 11 12 13 14 15 16 -5.111111 0.250000 0.250000 0.250000 0.250000 0.250000 0.250000 0.250000 17 0.250000 model\$fitted.values 1 2 3 4 5 6 7 8 9 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 -5.111111 10 11 12 13 14 15 16 17 0.250000 0.250000 0.250000 0.250000 0.250000 0.250000 0.250000 0.250000 library(car) qq.plot(model\$residuals) par(mfrow=c(1,1)) qq.plot(model\$residuals) We QQ plot residuals to determine if they are normal and can be used to compare w/ t sample t-test

Assumptions of the two-sample t-test

-independence (not too big a deal in t-test) -Normality of errors -mean = zero -homogeneity of variance (homostedasticity) tapply(DSST,Group,var) CU NS 30.21429 39.11111 30 - 39 is far less than 4-1 so homostedasticity assumption is met. library(car) levene.test(DSST,Group) Levene's Test for Homogeneity of Variance Df F value Pr(>F) group 1 0.0112 0.917 15 NOTE: SPSS does Levene's test by default and it runs it incorrectly! par(mfrow=c(2,2)) plot(model) ?t.test NOTE: Equality of variances is assumed to be false, so you must change to true t.test(DSST~Group,var.equal=T)

Two Sample t-test

data: DSST by Group
t = 1.866, df = 15, p-value = 0.08172
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.7625956 11.4848178
sample estimates:
mean in group CU mean in group NS
0.250000 -5.111111

We fail to reject the null hypothesis, because it seem slike there is no difference between cronic users and nieve subjects.
It seems like you don't gain anything from being a chronic user.
Either there are no significant differences, or we have a POWER issue.
NOTE: Degrees of freedom for a two sample t-test is (n-sub-1 - 1)+(n-sub-2 - 2)
t.test(DSST~Group)

Welch Two Sample t-test

data: DSST by Group
t = 1.8811, df = 15, p-value = 0.07951
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.713513 11.435735
sample estimates:
mean in group CU mean in group NS
0.250000 -5.111111

Cohen's d for effect size of two sample t-test

Because we assume homogeneity of variance, we can use the pooled standard deviations of the two samples See notes on two-sample t-test for the pooled standard deviation When we used the pooled SD we are estimating d and instead of calling it d-hat, we call it g in the two-sampled t-test. g is an estimation of the effect difference between the two samples g is a point estimate for d library(MBESS) ?smd smd(Group.1=subset(DSST,Group=="NS"),Group.2=subset(DSST,Group=="CU")) [1] -0.906721 NOTE: If you have a balanced design, we will get d-hat. If we have an unbalanced design we get g in R ci.smd(smd=-.906721,n.1=8,n.2=9) \$Lower.Conf.Limit.smd [1] -1.898482

\$smd
[1] -0.906721

\$Upper.Conf.Limit.smd
[1] 0.1119626

ci.smd(smd=-.906721,n.1=9,n.2=8)
\$Lower.Conf.Limit.smd
[1] -1.898482

\$smd
[1] -0.906721

\$Upper.Conf.Limit.smd
[1] 0.1119626

ci.smd(smd=.906721,n.1=9,n.2=8)
\$Lower.Conf.Limit.smd
[1] -0.1119626

\$smd
[1] 0.906721

\$Upper.Conf.Limit.smd
[1] 1.898482