Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Assignment; Class: APPLD MULTIVAR STAT; Subject: Statistics ; University: University of Nebraska - Lincoln; Term: Unknown 1989;
Typology: Assignments
1 / 4
prob2<-c(11, 33, 20, 28, 22, 20, 24, 30, 18, 27, 28, 26, 23, 22, 27, 26, 15, 31, 27, 18, 22, 16, 22, 30, 18, 21, 23, 18, 16, 15, 21, 24, 15, 17, 29, 18, 10, 12, 24, 20) prob2.2<-matrix(data = prob2, nrow=8, ncol=5) prob2. #The c(data) function creates a column vector of data. N<-nrow(prob2.2) p<-ncol(prob2.2) meanx1<-mean(prob2.2[,1]) meanx2<-mean(prob2.2[,2]) meanx3<-mean(prob2.2[,3]) meanx4<-mean(prob2.2[,4]) meanx5<-mean(prob2.2[,5]) mu.hat<-rbind(meanx1, meanx2, meanx3, meanx4, meanx5) mu.hat sigma.hat<-var(prob2.2) sigma.hat #remember that R is case sensitive! H<-matrix(data = c(1,1,1,1, -1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,-1),4,5) H q<-nrow(H) h<-matrix(0,q,1) h #PART A) #construct the Hotelling's T^2 for the hypothesis Ho:Hmu=h, Ha:Hmu<>h T.sq<-Nt(H%%mu.hat-h)%%solve(H%%sigma.hat%%t(H))%%(H%%mu.hat-h) p.val<-1-pf((N-q)/(q(N-1))*T.sq, q, N-q) cat("T.sq is", round(T.sq,2), "and the p-value is", round(p.val,4)) #critical value: qf(.95, q, N-q)
Time
Mean response 0 5 10 15 20 25 Time
Control Treatment
data set1; input gender$ height CC MUAC; datalines; F 80 58.4 14 F 75 59.2 15 F 78 60.3 15 F 75 57.4 13 F 79 59.5 14 F 78 58.1 14. F 75 58 12. F 64 55.5 11 F 80 59.2 12. M 78 60.6 16. M 76 58.1 12. M 92 63.2 14. M 81 59.0 14. M 81 60.8 15. M 84 59.5 14. ; run ; title2 'Proc factor output'; proc discrim data=set1 pool=test; class gender; var height CC MUAC; run ; The DISCRIM Procedure Test of Homogeneity of Within Covariance Matrices Notation: K = Number of Groups P = Number of Variables N = Total Number of Observations - Number of Groups N(i) = Number of Observations in the i'th Group - 1 __ N(i)/ || |Within SS Matrix(i)| V = ----------------------------------- N/ |Pooled SS Matrix| _ _ 2 | 1 1 | 2P + 3P - 1 RHO = 1.0 - | SUM ----- - --- | ------------- |_ N(i) N | 6(P+1)(K-1) DF = .5(K-1)P(P+1) _ _ | PN/2 | | N V | Under the null hypothesis: -2 RHO ln | ------------------ | | __ PN(i)/2 | | || N(i) _| is distributed approximately as Chi-Square(DF). Chi-Square DF Pr > ChiSq 3.321019 6 0.
Since the Chi-Square value is not significant at the 0.1 level, a pooled covariance matrix will be used in the discriminant function.
data set1; input gender$ height CC MUAC; datalines; F 80.00 58.40 14. F 75.00 59.20 15. F 78.00 60.30 15. F 75.00 57.40 13. F 79.00 59.50 14. F 78.00 58.10 14. F 75.00 58.00 12. F 64.00 55.50 11. F 80.00 59.20 12. ; run ; title2 'Proc factor output'; proc factor data=set1 method=ml; var height CC MUAC; run ;