STAT 511 Solutions to Homework 5 Spring 2004

Σχετικά έγγραφα
ΣΤΑΤΙΣΤΙΚΗ ΕΠΙΧΕΙΡΗΣΕΩΝ ΕΙΔΙΚΑ ΘΕΜΑΤΑ. Κεφάλαιο 13. Συμπεράσματα για τη σύγκριση δύο πληθυσμών

Funktionsdauer von Batterien in Abhängigkeit des verwendeten Materials und der Umgebungstemperatur

Αν οι προϋποθέσεις αυτές δεν ισχύουν, τότε ανατρέχουµε σε µη παραµετρικό τεστ.

Statistics 104: Quantitative Methods for Economics Formula and Theorem Review

Repeated measures Επαναληπτικές μετρήσεις

Supplementary Appendix

FORMULAS FOR STATISTICS 1

Επιστηµονική Επιµέλεια ρ. Γεώργιος Μενεξές. Εργαστήριο Γεωργίας. Viola adorata

Γραµµική Παλινδρόµηση

Ανάλυση της ιακύµανσης

Μηχανική Μάθηση Hypothesis Testing

Εισαγωγή στην Ανάλυση Διακύμανσης

Section 8.3 Trigonometric Equations

( ) ( ) STAT 5031 Statistical Methods for Quality Improvement. Homework n = 8; x = 127 psi; σ = 2 psi (a) µ 0 = 125; α = 0.

519.22(07.07) 78 : ( ) /.. ; c (07.07) , , 2008

Wan Nor Arifin under the Creative Commons Attribution-ShareAlike 4.0 International License. 1 Introduction 1

Queensland University of Technology Transport Data Analysis and Modeling Methodologies

EE512: Error Control Coding

Άσκηση 10, σελ Για τη μεταβλητή x (άτυπος όγκος) έχουμε: x censored_x 1 F 3 F 3 F 4 F 10 F 13 F 13 F 16 F 16 F 24 F 26 F 27 F 28 F

APPENDICES APPENDIX A. STATISTICAL TABLES AND CHARTS 651 APPENDIX B. BIBLIOGRAPHY 677 APPENDIX C. ANSWERS TO SELECTED EXERCISES 679

2. ΧΡΗΣΗ ΣΤΑΤΙΣΤΙΚΩΝ ΠΑΚΕΤΩΝ ΣΤΗ ΓΡΑΜΜΙΚΗ ΠΑΛΙΝΔΡΟΜΗΣΗ

PENGARUHKEPEMIMPINANINSTRUKSIONAL KEPALASEKOLAHDAN MOTIVASI BERPRESTASI GURU TERHADAP KINERJA MENGAJAR GURU SD NEGERI DI KOTA SUKABUMI

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Παράδειγμα: Γούργουλης Βασίλειος, Επίκουρος Καθηγητής Τ.Ε.Φ.Α.Α.-Δ.Π.Θ.

Problem Set 9 Solutions. θ + 1. θ 2 + cotθ ( ) sinθ e iφ is an eigenfunction of the ˆ L 2 operator. / θ 2. φ 2. sin 2 θ φ 2. ( ) = e iφ. = e iφ cosθ.

TABLES AND FORMULAS FOR MOORE Basic Practice of Statistics

τατιςτική ςτην Εκπαίδευςη II

Math 6 SL Probability Distributions Practice Test Mark Scheme

w o = R 1 p. (1) R = p =. = 1

Approximation of distance between locations on earth given by latitude and longitude

Supplementary figures

Απλή Ευθύγραµµη Συµµεταβολή

Wan Nor Arifin under the Creative Commons Attribution-ShareAlike 4.0 International License. 1 Introduction 1

6.3 Forecasting ARMA processes

ECE 308 SIGNALS AND SYSTEMS FALL 2017 Answers to selected problems on prior years examinations

Abstract ] [ Lawley Hotelling Trace).statigraph. Hotel ling s trace

Numerical Analysis FMN011

Παράδειγμα: Γούργουλης Βασίλειος, Επίκουρος Καθηγητής Τ.Ε.Φ.Α.Α. Δ.Π.Θ.

Homework 3 Solutions

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Example Sheet 3 Solutions

Statistical Inference I Locally most powerful tests

Biostatistics for Health Sciences Review Sheet

Άσκηση 11. Δίνονται οι παρακάτω παρατηρήσεις:

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

C.S. 430 Assignment 6, Sample Solutions

Λογαριθμικά Γραμμικά Μοντέλα Poisson Παλινδρόμηση Παράδειγμα στο SPSS

Μενύχτα, Πιπερίγκου, Σαββάτης. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 6 ο

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

Παράδειγμα: Γούργουλης Βασίλειος, Επίκουρος Καθηγητής Τ.Ε.Φ.Α.Α.-Δ.Π.Θ.

Optimizing Microwave-assisted Extraction Process for Paprika Red Pigments Using Response Surface Methodology

Μαντζούνη, Πιπερίγκου, Χατζή. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 5 ο

Μενύχτα, Πιπερίγκου, Σαββάτης. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 5 ο

Ενότητα 3: Ανάλυση Διακύμανσης κατά ένα παράγοντα One-Way ANOVA

5.1 logistic regresssion Chris Parrish July 3, 2016

Ανάλυση Δεδομένων με χρήση του Στατιστικού Πακέτου R

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Reminders: linear functions

Υπολογιστική Φυσική Στοιχειωδών Σωματιδίων

Statistics & Research methods. Athanasios Papaioannou University of Thessaly Dept. of PE & Sport Science

+ ε βελτιώνει ουσιαστικά το προηγούμενο (β 3 = 0;) 2. Εξετάστε ποιο από τα παρακάτω τρία μοντέλα:

Modern Regression HW #8 Solutions

χ 2 test ανεξαρτησίας

The Simply Typed Lambda Calculus

1. Ηλεκτρικό μαύρο κουτί: Αισθητήρας μετατόπισης με βάση τη χωρητικότητα

SECTION II: PROBABILITY MODELS

( ) 2 and compare to M.

ΑΝΑΛΥΣΗ Ε ΟΜΕΝΩΝ. 8. Ανάλυση διασποράς (ANOVA)

Table 1: Military Service: Models. Model 1 Model 2 Model 3 Model 4 Model 5 Model 6 Model 7 Model 8 Model 9 num unemployed mili mili num unemployed

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

HW 3 Solutions 1. a) I use the auto.arima R function to search over models using AIC and decide on an ARMA(3,1)

Section 7.6 Double and Half Angle Formulas

τατιστική στην Εκπαίδευση II

Aquinas College. Edexcel Mathematical formulae and statistics tables DO NOT WRITE ON THIS BOOKLET

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

Inverse trigonometric functions & General Solution of Trigonometric Equations

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Strain gauge and rosettes

CRASH COURSE IN PRECALCULUS

«Χρήσεις γης, αξίες γης και κυκλοφοριακές ρυθμίσεις στο Δήμο Χαλκιδέων. Η μεταξύ τους σχέση και εξέλιξη.»

DOUGLAS FIR BEETLE TRAP-SUPPRESSION STUDY STATISTICAL REPORT

Szabolcs Sofalvi, M.S., D-ABFT-FT Cleveland, Ohio

Section 9.2 Polar Equations and Graphs

Generalized additive models in R

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

Module 5. February 14, h 0min

Για να ελέγξουµε αν η κατανοµή µιας µεταβλητής είναι συµβατή µε την κανονική εφαρµόζουµε το test Kolmogorov-Smirnov.

Math221: HW# 1 solutions

8. ΑΠΛΗ ΓΡΑΜΜΙΚΗ ΠΑΛΙΝΔΡΟΜΗΣΗ Ι

ΗΜΥ 220: ΣΗΜΑΤΑ ΚΑΙ ΣΥΣΤΗΜΑΤΑ Ι Ακαδημαϊκό έτος Εαρινό Εξάμηνο Κατ οίκον εργασία αρ. 2

Srednicki Chapter 55

Appendix to On the stability of a compressible axisymmetric rotating flow in a pipe. By Z. Rusak & J. H. Lee

Second Order RLC Filters

η πιθανότητα επιτυχίας. Επομένως, η συνάρτηση πιθανοφάνειας είναι ίση με: ( ) 32 = p 18 1 p

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Partial Differential Equations in Biology The boundary element method. March 26, 2013

$ι ιι η ι ι!η ηι ι ANOVA. To ANOVA ι ι ι η η η ιη (Analysis of Variance). * ι! ι ι ι ι ι η ιη. ;, ι ι ι! η ιι ηιη ι ι!η ι η η ιη ι ι η ι η.

Appendix A3. Table A3.1. General linear model results for RMSE under the unconditional model. Source DF SS Mean Square

Transcript:

STAT 5 Solutions to Homework 5 Spring 004. Use data set particle.txt. (a) > particle <- read.table("hw05.data.txt", header=t) > full <- lm(y~temp+time+i(temp^)+i(time^)+temp*time, data=particle) > summary(full) Estimate Std. Error t value Pr(> t ) (Intercept) 76.795.0649 6.65 < e-6 *** temp -.99044 0.6754-7.850 < e-6 *** time.88684 0.40767 9.54.7e-0 *** I(temp^) -0.650 0.05987-0.86.50e- *** I(time^) -.57500 0.66-4.5 0.00070 *** temp:time -0.556 0.076-5.55.8e-05 *** Residual standard error:.554 on 8 degrees of freedom Multiple R-Squared: 0.9548, Adjusted R-squared: 0.9467 F-statistic: 8. on 5 and 8 DF, p-value: <.e-6 > library(mass) > qqnorm(stdres(full)) Normal Q Q Plot Sample Quantiles 0 4 0 Theoretical Quantiles (b) > reduced <- lm(y~temp+time,data=particle) > anova(reduced,full) Analysis of Variance Table Model : y ~ temp + time Model : y ~ temp + time + I(temp^) + I(time^) + temp * time Res.Df RSS Df Sum of Sq F Pr(>F) 65.90 8 5.66 00.4 60.705.59e- *** We reject the null hypothesis, p-value< 0.000. Therefore, a quadratic curvature in response (as a function of x s) appears to be statistically detectable. (c) [ ] [ ] [ ] [ ] x β = β5 β.050 = is where we have a local maximum. [ We should check that it x β 5 β 4 β.769 is a maximum and that it is the absolute maximum. ]

Using functions that are built into R. > max.x <- data.frame(-.050440,.76884) > names(max.x) <- c("temp","time") > predict(full,max.x, interval="confidence",level=0.90) fit lwr upr [,] 84.7997 8.5944 86.995 > predict(full,max.x, interval="prediction",level=0.90) fit lwr upr [,] 84.7997 78.605 9.74 Using matrix calculations. x0 <- c(, max.x$temp, max.x$time, max.x$temp^, max.x$time^, max.x$temp*max.x$time) y0 <- sum(full$coef*x0) X <- cbind(rep(,dim(particle)[]), particle$temp, particle$time, particle$temp^, particle$time^, particle$temp*particle$time) MSE <- anova(full)$mean[length(anova(full)$mean)] cxxc <- x0%*%ginv(t(x)%*%x)%*%x0 ll <- y0 - qt(0.95,full$df.residual)*sqrt(mse*cxxc) # lower and upper confidence limits ul <- y0 + qt(0.95,full$df.residual)*sqrt(mse*cxxc) ll <- y0 - qt(0.95,full$df.residual)*sqrt(mse*(+cxxc)) # lower and upper prediction limits ul <- y0 + qt(0.95,full$df.residual)*sqrt(mse*(+cxxc)). There is weak evidence of lack of fit, p-value = 0.055. Using functions that are built into R. > cells <- lm(y~as.factor(temp)*as.factor(time),data=particle) > anova(cells,full) Analysis of Variance Table Model : y ~ as.factor(temp) * as.factor(time) Model : y ~ temp + time + I(temp^) + I(time^) + temp * time Res.Df RSS Df Sum of Sq F Pr(>F) 4 0.44 8 5.66-4 -4. 5.479 0.05478 Using matrix calculations. > Y <- particle$y > F.ratio <- ((t(y)%*%(project(xstar)-project(x))%*%y)/(0-6))/ ((t(y)%*%(diag(rep(,4))-project(xstar))%*%y)/(4-0)) > p.value <- -pf(f.ratio,0-6,4-0). Use scenario of Problem 4.7 of Rencher. (a) > d y protein meat 7 0 8... 46 97 47 06 (b) > attach(d) # The database "d" is searched by R when evaluating a variable > means <- tapply(y,list(meat,protein),mean) > means 96.50000 79.0000 85.90000 9.8 95.6667 8.00000

(c) > matplot(c(,),c(60,0),type="n",xlab="meat",ylab="mean Response",main="Weight Gain") > matlines(x.axis,means,type="b",cex=) Weight Gain Mean Response 60 70 80 90 00 0.0.5.0.5.0 Meat (d) options(contrasts=c("contr.sum","contr.sum")) lm.out <- lm(y~protein*meat,data=d) > summary.aov(lm.out,sstype=) protein 89. 89. 4.096 0.05. meat.8 6.9 0.06 0.9670 protein:meat 95.7 597.9.9057 0.06605. Residuals 4 846. 05.8 > lm.out <- lm(y~meat*protein,data=d) > summary.aov(lm.out,sstype=) meat 6.4 8. 0.099 0.96097 protein 86.5 86.5 4.070 0.0568. meat:protein 95.7 597.9.9057 0.06605. Residuals 4 846. 05.8 (e) Using matrix calculations. i. Using the sum restrictions. Numerical results are shown in part (f). Xeffects <- model.matrix(lm.out) # Type I ssa <- t(d$y)%*%(project(xeffects[,:])-project(xeffects[,]))%*%d$y # R(a mu) ssb <- t(d$y)%*%(project(xeffects[,:4])-project(xeffects[,:]))%*%d$y ssab <- t(d$y)%*%(project(xeffects)-project(xeffects[,:4]))%*%d$y # Type II ssa <- t(d$y)%*%(project(xeffects[,:4])-project(xeffects[,c(,,4)]))%*%d$y ssb <- t(d$y)%*%(project(xeffects[,:4])-project(xeffects[,c(,)]))%*%d$y ssab <- t(d$y)%*%(project(xeffects)-project(xeffects[,:4]))%*%d$y Xcells <- matrix(0,47,6) Xcells[:8,]<- matrix(rep(c(,0,0,0,0,0),8),8,6,byrow=t) Xcells[9:8,]<- matrix(rep(c(0,,0,0,0,0),0),0,6,byrow=t) Xcells[9:4,]<- matrix(rep(c(0,0,,0,0,0),6),6,6,byrow=t) Xcells[5:4,]<- matrix(rep(c(0,0,0,,0,0),0),0,6,byrow=t) Xcells[5:40,]<- matrix(rep(c(0,0,0,0,,0),6),6,6,byrow=t) Xcells[4:47,]<- matrix(rep(c(0,0,0,0,0,),7),7,6,byrow=t)

# Type III C <- matrix(c(/,/,/,-/,-/,-/),,6,byrow=t) # For SSprotein C <- matrix(c(rep(c(/,-/,0),),rep(c(/,0,-/),)),,6,byrow=t) # For SSmeat CXXC <- C%*%ginv(t(Xcells)%*%Xcells)%*%t(C) Cb <- C%*%ginv(t(Xcells)%*%Xcells)%*%t(Xcells)%*%d$y SSH0 <- t(cb)%*%solve(cxxc)%*%cb # Gives the value of SS ii. Using the SAS baseline restriction we obtain the same results as with the sum restriction. Xsas <- matrix(na,47,6) Xsas[,] <- rep(,47) Xsas[,] <- c(rep(,4),rep(0,)) Xsas[,] <- c(rep(,8),rep(0,6),rep(,0),rep(0,)) Xsas[,4] <- c(rep(0,8),rep(,0),rep(0,6),rep(,6),rep(0,7)) Xsas[,5] <- Xsas[,]*Xsas[,] Xsas[,6] <- Xsas[,]*Xsas[,4] # Type I ssa <- t(d$y)%*%(project(xsas[,:])-project(xsas[,]))%*%d$y # R(a mu) ssb <- t(d$y)%*%(project(xsas[,:4])-project(xsas[,:]))%*%d$y ssab <- t(d$y)%*%(project(xsas)-project(xsas[,:4]))%*%d$y # Type II ssa <- t(d$y)%*%(project(xsas[,:4])-project(xsas[,c(,,4)]))%*%d$y ssb <- t(d$y)%*%(project(xsas[,:4])-project(xsas[,c(,)]))%*%d$y ssab <- t(d$y)%*%(project(xsas)-project(xsas[,:4]))%*%d$y (f) Using function anova() for Type I and function Anova() from package car for Types II and III. Anova Table (Type I tests) protein 89. 89. 4.096 0.05. meat.8 6.9 0.06 0.9670 protein:meat 95.7 597.9.9057 0.06605. Residuals 4 846. 05.8 Anova Table (Type II tests) protein 86.5 4.070 0.0568. meat.8 0.06 0.9670 protein:meat 95.7.9057 0.06605. Residuals 846. 4 Anova Table (Type III tests) (Intercept) 598 707.806 < e-6 *** protein 75.650 0.0604. meat 9 0.0 0.9780 protein:meat 96.9057 0.06605. Residuals 846 4 4. Use fake -way factorial data. (a) Repeat parts (a)-(e) of Problem on these data. i. > fake Y A B 4 4

0 4 5 9 6 7 8 6 9 7 0 0 7 ii. > means <- tapply(fake$y,list(fake$a,fake$b),mean) > means 4.0.0 9.5 6.5 0.0 7.0 iii. > x.axis <- unique(fake$a) > matplot(c(,),c(5,5),type="n",xlab="factor A",ylab="Mean Response") > matlines(x.axis,means,type="b") Mean Response 6 8 0 4.0.5.0.5.0 Factor A iv. > fake$a <- as.factor(fake$a) > fake$b <- as.factor(fake$b) > options(contrasts=c("contr.sum","contr.sum")) > lm.out <- lm(y~a*b,data=fake) > summary.aov(lm.out,sstype=) A.50.5.50 0.04095 * B 7.09 8.50 8.595 0.005 * A:B 4.68 0.657 0.6569 0.668 Residuals.000.000 > lm.out <- lm(y~b*a,data=fake) > summary.aov(lm.out,sstype=) B 9.0500 4.550 4.550 0.0864 * A 0.9 5.95 5.95 0.07 * B:A 4.676 0.6569 0.6569 0.668 Residuals.0000.0000 v. Using matrix calculations. Using the sum restrictions. Numerical results are shown in part (vi). Xeffects <- model.matrix(lm.out) Y <- fake$y 5

# Type I ssa <- t(y)%*%(project(xeffects[,:])-project(xeffects[,]))%*%y # R(a mu) ssb <- t(y)%*%(project(xeffects[,:5])-project(xeffects[,:]))%*%y ssab <- t(y)%*%(project(xeffects)-project(xeffects[,:5]))%*%y # Type II ssa <- t(y)%*%(project(xeffects[,:5])-project(xeffects[,c(,4,5)]))%*%y ssb <- t(y)%*%(project(xeffects[,:5])-project(xeffects[,c(,,)]))%*%y ssab <- t(y)%*%(project(xeffects)-project(xeffects[,:5]))%*%y > Xcells 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # Type III # For SSA C <- matrix(c(/,/,/,0,0,0,-/,-/,-/,0,0,0,/,/,/,-/,-/,-/),,9,byrow=t) # For SSB C <- matrix(c(rep(c(/,0,-/),),rep(c(0,/,-/),)),,9,byrow=t) CXXC <- C%*%ginv(t(Xcells)%*%Xcells)%*%t(C) Cb <- C%*%ginv(t(Xcells)%*%Xcells)%*%t(Xcells)%*%Y SSH0 <- t(cb)%*%solve(cxxc)%*%cb # Gives the value of SS Using the SAS baseline restriction we obtain the same results as with the sum restriction. > Xsas 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 5 0 0 0 0 0 6 0 0 0 0 0 7 0 0 0 0 0 8 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # Type I ssa <- t(y)%*%(project(xsas[,:])-project(xsas[,]))%*%y # R(a mu) ssb <- t(y)%*%(project(xsas[,:5])-project(xsas[,:]))%*%y ssab <- t(y)%*%(project(xsas)-project(xsas[,:5]))%*%y 6

# Type II ssa <- t(y)%*%(project(xsas[,:5])-project(xsas[,c(,4,5)]))%*%y ssb <- t(y)%*%(project(xsas[,:5])-project(xsas[,c(,,)]))%*%y ssab <- t(y)%*%(project(xsas)-project(xsas[,:5]))%*%y vi. Using function anova() for Type I and function Anova() from package car for Types II and III. > anova(lm.out) Anova Table (Type I tests) A.50.5.50 0.04095 * B 7.09 8.50 8.595 0.005 * A:B 4.68 0.657 0.6569 0.668 Residuals.000.000 Anova Table (Type II tests) A 0.9 5.95 0.07 * B 7.09 8.595 0.005 * A:B.68 4 0.6569 0.668 Residuals.000 Anova Table (Type III tests) (Intercept) 8.5 8.5 5.798e-05 *** A 5..554 0.0487 * B. 6.655 0.0474 * A:B.6 4 0.6569 0.668 Residuals.00 (b) Xincomp.full <- Xcells[-c(6,7),-5] Xincomp.red <- Xeffects[-c(6,7),:5] Y.incomp <- Y[-c(6,7)] full <- lm(y.incomp~xincomp.full-) reduced <- lm(y.incomp~xincomp.red-) anova(reduced,full) Analysis of Variance Table Model : Y.incomp ~ Xincomp.red - Model : Y.incomp ~ Xincomp.full - Res.Df RSS Df Sum of Sq F Pr(>F) 5.898.5000.98 0.546 0.7954 F-ratio = 0.5 with p-value= 0.7954. There is not enough evidence that there is interaction between factors A and B. (c) X <- Xeffects[-c(6,7),:5] C <- c(,0,,0,) mu <- C%*%ginv(t(X)%*%X)%*%t(X)%*%Y.incomp > mu [,] [,] 0.085 7