Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Applied Multivariable Statistic - Homework 10 Practice Problems | STAT 873, Assignments of Statistics

Material Type: Assignment; Class: APPLD MULTIVAR STAT; Subject: Statistics ; University: University of Nebraska - Lincoln; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-xjk
koofers-user-xjk 🇺🇸

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Applied Multivariable Statistic - Homework 10 Practice Problems | STAT 873 and more Assignments Statistics in PDF only on Docsity!

HW Chapter 10

Problem

a) T^2 =55.71. p-value=0.0346. Below is my code.

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)

g) T^2 =47.93, p-value=0.

h)

Time

-

0

Mean response 0 5 10 15 20 25 Time

0

Control Treatment

T^2 =4.53, p-value=0.71 – test for interaction

i) Control vs. treatment main effect

T^2 =0.06, p-value=0.

Problem

a) I used the tests available in PROC DISCRIM in SAS

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.

Problem #4 – I wrote a R program using ex10_1.R as a template. The test statistic is 28.49 and the

p-value is 0.000029 (using the distributional approximations given in class – different from Johnson’s

PROC IML program)

Problem #5 – I used PROC FACTOR in SAS. The test statistic is 12.20 and the p-value is 0.0067.

Below is the SAS code:

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 ;