# Lab 10 20 maggio 21 IS # Es. 1 dati=c(63, 65, 94, 37, 83, 95, 70, 96, 47, 29, 52, 38, 47, 79, 66, 25, 48, 80, 52, 49) n=length(dati) # (a) t.test(dati)$conf.int # (b) t.test(dati, alternative = "two.sided", conf.level = 0.95, mu=70) # t.oss=-1.8948 2*pt(-abs(t.oss),n-1) 2*(1-pt(abs(t.oss),n-1)) # (e) var(dati) x.med=60.75 theta.0=70 t.oss=t.test(dati, alternative = "two.sided", conf.level = 0.95, mu=70)$statistic S.n=sqrt(n)*(x.med-theta.0)/t.oss S.n^2 t.test(dati, alternative = "two.sided", conf.level = 0.95, mu=70)$statistic # (g) t.test(dati, alternative = "less", conf.level = 0.99, mu=70) # Es. 2 x.a=c(100,125,135,128,140,142,128,137,156,142,134,122,100,98,101) x.b=c(95,87,100,75,110,85,95,98,96,100,107) n.a=length(x.a) n.b=length(x.b) n.a+n.b-2 # (f) t.test(x.a,x.b)$conf.int t.test(x.a,x.b, var.equal=TRUE) t.test(x.a,x.b, mu=40, var.equal=TRUE) t.test(x.a,x.b, mu=45, alternative="less", var.equal=TRUE) # Es. 3 data(women) women attach(women) height weight data()