STA442/2101: Assignment 5

Similar documents
STA 302f16 Assignment Five 1

STA 2101/442 Assignment 3 1

STA 2201/442 Assignment 2

STA 2101/442 Assignment Four 1

The Multivariate Normal Distribution 1

STA 431s17 Assignment Eight 1

The Multivariate Normal Distribution 1

Random Vectors 1. STA442/2101 Fall See last slide for copyright information. 1 / 30

STA441: Spring Multiple Regression. This slide show is a free open source document. See the last slide for copyright information.

UNIVERSITY OF TORONTO Faculty of Arts and Science

Interactions and Factorial ANOVA

Interactions and Factorial ANOVA

The Multinomial Model

Factorial ANOVA. More than one categorical explanatory variable. See last slide for copyright information 1

Regression. ECO 312 Fall 2013 Chris Sims. January 12, 2014

Factorial ANOVA. STA305 Spring More than one categorical explanatory variable

The Bootstrap 1. STA442/2101 Fall Sampling distributions Bootstrap Distribution-free regression example

(a) (3 points) Construct a 95% confidence interval for β 2 in Equation 1.

[y i α βx i ] 2 (2) Q = i=1

STA441: Spring Multiple Regression. More than one explanatory variable at the same time

Probability and Statistics Notes

Generalized Linear Models 1

Problems. Suppose both models are fitted to the same data. Show that SS Res, A SS Res, B

Part IB Statistics. Theorems with proof. Based on lectures by D. Spiegelhalter Notes taken by Dexter Chua. Lent 2015

STAT 135 Lab 13 (Review) Linear Regression, Multivariate Random Variables, Prediction, Logistic Regression and the δ-method.

22s:152 Applied Linear Regression

STA 2101/442 Assignment 2 1

Simple and Multiple Linear Regression

INTERVAL ESTIMATION AND HYPOTHESES TESTING

Correlation 1. December 4, HMS, 2017, v1.1

Contingency Tables Part One 1

Lecture 11. Multivariate Normal theory

Introduction 1. STA442/2101 Fall See last slide for copyright information. 1 / 33

BTRY 4830/6830: Quantitative Genomics and Genetics Fall 2014

Stat 135, Fall 2006 A. Adhikari HOMEWORK 10 SOLUTIONS

Linear Regression. In this lecture we will study a particular type of regression model: the linear regression model

Multivariate Regression (Chapter 10)

Stat 135 Fall 2013 FINAL EXAM December 18, 2013

First Year Examination Department of Statistics, University of Florida

AMS 7 Correlation and Regression Lecture 8

Multiple Linear Regression

Power and Sample Size for Log-linear Models 1

Simple Linear Regression

Multilevel Models in Matrix Form. Lecture 7 July 27, 2011 Advanced Multivariate Statistical Methods ICPSR Summer Session #2

Normal (Gaussian) distribution The normal distribution is often relevant because of the Central Limit Theorem (CLT):

Answers to Problem Set #4

Ch 2: Simple Linear Regression

Statistical Inference: Estimation and Confidence Intervals Hypothesis Testing

AGEC 621 Lecture 16 David Bessler

Chapter 12 - Lecture 2 Inferences about regression coefficient

Data Mining Stat 588

Linear Models and Estimation by Least Squares

EC212: Introduction to Econometrics Review Materials (Wooldridge, Appendix)

Lecture 6 Multiple Linear Regression, cont.

Ma 3/103: Lecture 25 Linear Regression II: Hypothesis Testing and ANOVA

Regression Review. Statistics 149. Spring Copyright c 2006 by Mark E. Irwin

Regression Part II. One- factor ANOVA Another dummy variable coding scheme Contrasts Mul?ple comparisons Interac?ons

Covariance and Correlation

MATH 829: Introduction to Data Mining and Analysis Linear Regression: statistical tests

Exam Applied Statistical Regression. Good Luck!

Lecture 15. Hypothesis testing in the linear model

STAT 135 Lab 6 Duality of Hypothesis Testing and Confidence Intervals, GLRT, Pearson χ 2 Tests and Q-Q plots. March 8, 2015

Scatter plot of data from the study. Linear Regression

Lecture 5: Clustering, Linear Regression

BANA 7046 Data Mining I Lecture 2. Linear Regression, Model Assessment, and Cross-validation 1

Master s Written Examination

Matrix Approach to Simple Linear Regression: An Overview

Profile Analysis Multivariate Regression

Regression Estimation - Least Squares and Maximum Likelihood. Dr. Frank Wood

Lectures on Simple Linear Regression Stat 431, Summer 2012

Lecture 9. ANOVA: Random-effects model, sample size

STT 843 Key to Homework 1 Spring 2018

Lecture 2. The Simple Linear Regression Model: Matrix Approach

Simple Linear Regression for the Climate Data

Final Exam. 1. (6 points) True/False. Please read the statements carefully, as no partial credit will be given.

GARCH Models Estimation and Inference

MS&E 226: Small Data

STAT 135 Lab 7 Distributions derived from the normal distribution, and comparing independent samples.

Hypothesis Testing One Sample Tests

Inference for Regression

Linear Models Review

STAT 705 Chapter 16: One-way ANOVA

1 Least Squares Estimation - multiple regression.

Scatter plot of data from the study. Linear Regression

Lecture 5: Clustering, Linear Regression

Multivariate Linear Models

Problem 1 (20) Log-normal. f(x) Cauchy

Regression Analysis and Forecasting Prof. Shalabh Department of Mathematics and Statistics Indian Institute of Technology-Kanpur

Summer School in Statistics for Astronomers V June 1 - June 6, Regression. Mosuk Chow Statistics Department Penn State University.

Sampling Distributions

Instrumental Variables Again 1

1.) Fit the full model, i.e., allow for separate regression lines (different slopes and intercepts) for each species

Simple Linear Regression

CS229 Lecture notes. Andrew Ng

WISE MA/PhD Programs Econometrics Instructor: Brett Graham Spring Semester, Academic Year Exam Version: A

18.S096 Problem Set 3 Fall 2013 Regression Analysis Due Date: 10/8/2013

MLR Model Selection. Author: Nicholas G Reich, Jeff Goldsmith. This material is part of the statsteachr project

5.2 Expounding on the Admissibility of Shrinkage Estimators

ANOVA: Analysis of Variance - Part I

Transcription:

STA442/2101: Assignment 5 Craig Burkett Quiz on: Oct 23 rd, 2015 The questions are practice for the quiz next week, and are not to be handed in. I would like you to bring in all of the code you used to run this assignment, and the output it generates. The best way to do this is just to run all of your code, and copy the console output to a.txt file and print it out. Clearly, your code should not print things that are not asked for, like an entire data frame. Even though you might want to look at the data frame while writing your code, your final version should only print the answers to the questions. Your console output (with code) should fit on two pages, double-sided, with two columns per side, at most. If your output is longer than 8 single pages (about 400 lines) you could probably tidy things up a bit. Remember, a whole lot of nonsense is not the same thing as concise, tidy code, even if the conclusions are the same. If you want to experiment with R Markdown files to make it look nicer, be my guest! I might show these a little later in the course. Remember, the computer assignments in this course are not group projects. You are expected to do the work yourself. You may compare numerical answers but do not share R code! This assignment was prepared by Craig Burkett with contributions from Jerry Brunner, both of the Department of Statistics, University of Toronto. It is licensed under a Creative Commons Attribution - ShareAlike 3.0 Unported License. Use any part of it as you like and share the result freely. 1

We re going to be expressing all of our results using matrices shortly, so let s get comfortable using them. 1. If the p 1 random vector X has variance-covariance matrix Σ and A is an m p matrix of constants, prove that the variance-covariance matrix of AX is AΣA. Start with the definition of a variance-covariance matrix: V (Z) = E(Z µ z )(Z µ z ). 2. If the p 1 random vector X has mean µ and variance-covariance matrix Σ, show Σ = E(XX ) µµ. 3. Let the p 1 random vector X have mean µ and variance-covariance matrix Σ, and let c be a p 1 vector of constants. Find V (X + c). Show your work. 4. Let X be a p 1 random vector with mean µ x and variance-covariance matrix Σ x, and let Y be a q 1 random vector with mean µ y and variance-covariance matrix Σ y. Recall that C(X, Y) is the p q matrix C(X, Y) = E ( (X µ x )(Y µ y ) ). (a) What is the (i, j) element of C(X, Y)? (b) Simplify for the special case where Cov(X i, Y j ) = 0 for all i and j. (c) Let c be a p 1 vector of constants and d be a q 1 vector of constants. Find C(X + c, Y + d). Show your work. (d) If p = q, find an expression for V (X + Y) in terms of Σ x, Σ y and C(X, Y). Show your work. 5. The joint moment-generating ( ) function of a p-dimensional random vector X is defined as M X (t) = E e t X. (a) Let Y = AX, where A is a matrix of constants. Find the moment-generating function of Y in terms of M X (t). (b) Let Y = X+c, where c is a p 1 vector of constants. Find the moment-generating function of Y in terms of M X (t). (c) Let Y = AX + c, as above. Find the moment-generating function of Y in terms of M X (t). 6. Let Z 1,..., Z p i.i.d. N(0, 1), and Z = Z 1. Z p. (a) What is the joint moment-generating function of Z? Show some work. 2

(b) Let Y = Σ 1/2 Z + µ, where Σ is a p p symmetric non-negative definite matrix and µ R p. i. What is E(Y)? ii. What is the variance-covariance matrix of Y? Show some work. iii. What is the moment-generating function of Y? Show your work. 7. We say the p-dimensional random vector Y is multivariate normal with expected value µ and variance-covariance matrix Σ, and write Y N p (µ, Σ), when Y has momentgenerating function M Y (t) = e t µ+ 1 2 t Σt. (a) Let Y N p (µ, Σ) and W = AY, where A is an r p matrix of constants. What is the distribution of W? Show your work. (b) Let Y N p (µ, Σ) and W = Y + c, where A is an p 1 vector of constants. What is the distribution of W? Show your work. 8. Let Y N 2 (µ, Σ), with Y = ( Y1 Y 2 ) µ = ( µ1 µ 2 ) ( σ 2 Σ = 1 0 0 σ2 2 ) Using moment-generating functions, show Y 1 and Y 2 are independent. 9. Let X = (X 1, X 2, X 3 ) be multivariate normal with 1 1 0 0 µ = 0 and Σ = 0 2 0 6 0 0 1 Let Y 1 = X 1 + X 2 and Y 2 = X 2 + X 3. Find the joint distribution of Y 1 and Y 2. 10. Let X 1 be Normal(µ 1, σ 2 1), and X 2 be Normal(µ 2, σ 2 2), independent of X 1. What is the joint distribution of Y 1 = X 1 + X 2 and Y 2 = X 1 X 2? What is required for Y 1 and Y 2 to be independent? Hint: Use matrices. 11. Let Y = Xβ + ɛ, where X is an n p matrix of known constants, β is a p 1 vector of unknown constants, and ɛ is multivariate normal with mean zero and covariance matrix σ 2 I n, where σ 2 > 0 is a constant. In the following, it may be helpful to recall that (A 1 ) = (A ) 1. (a) What is the distribution of Y? (b) The maximum likelihood estimate (MLE) of β is ˆβ = (X X) 1 X Y. What is the distribution of ˆβ? Show the calculations. (c) Let Ŷ = Xˆβ. What is the distribution of Ŷ? Show the calculations.. 3

(d) Let the vector of residuals e = (Y Ŷ). What is the distribution of e? Show the calculations. Simplify both the expected value (which is zero) and the covariance matrix. 12. Show that if X N p (µ, Σ), Y = (X µ) Σ 1 (X µ) has a chi-square distribution with p degrees of freedom. Hint: See question 6 13. Let X 1,..., X n be a random sample from a N(µ, σ 2 ) distribution. Show Cov(X, (X j X)) = 0 for j = 1,..., n. This is the key to showing X and S 2 independent, a fact you may use without proof in the next problem. 14. Recall that the chi-squared distribution with ν degrees of freedom is just Gamma with α = ν 2 and β = 2. So if X χ2 (ν), it has moment-generating function M X (t) = (1 2t) ν/2. (a) Let Y = X 1 + X 2, where X 1 and X 2 are independent, X 1 χ 2 (ν 1 ) and Y χ 2 (ν 1 + ν 2 ), where ν 1 and ν 2 are both positive. Show X 2 χ 2 (ν 2 ). (b) Let X 1,..., X n be random sample from a N(µ, σ 2 ) distribution. Show (n 1)S 2 σ 2 χ 2 (n 1). Hint: n i=1 (X i µ) 2 = n i=1 ( Xi X + X µ ) 2 =... 15. Consider a two-factor analysis of variance in which each factor has two levels. Use this regression model for the problem: where d i,a and d i,b are dummy variables. Y i = β 0 + β 1 d i,a + β 2 d i,b + β 3 d i,a d i,b + ɛ i, (a) Make a two-by-two table showing the four treatment means in terms of β values. Use effect coding (the scheme with 0, 1, 1). In terms of the β values, state the null hypothesis you would use to test for i. Main effect of factor A ii. Main effect of factor B iii. Interaction (b) Make a two-by-two table showing the four treatment means in terms of β values. Use reference group coding. In terms of the β values, state the null hypothesis you would use to test for the same three questions above. (c) Which dummy variable scheme do you like more? 4

16. Arsenic is a powerful poison, which is why it has been used on farms for many years to kill insects. Even in very small amounts, arsenic can cause cancer in humans, and recently it has been found that rice and foods made from rice tend to be very high in arsenic. Brown rice is worse, by the way. In a controlled experiment, pots of rice were prepared by either washing the rice first or not, and by cooking the rice in either a low, a medium or a high amount of water. The response variable is amount of arsenic in the cooked rice. (a) Use a regression model with cell means coding. That s the model with no intercept, and one indicator dummy variable for each treatment combination. You don t have to say how the dummy variables are defined. That will become clear in the next part. Just give the regression equation. (b) Write the expected amounts of arsenic in the table below, in terms of the β parameters of your model. Washed Unwashed Amount of Water Low Medium High (c) If you wanted to test whether the effect of washing the rice depended on how much water you cook it in, what is the null hypothesis? Give your answer in terms of the β values in your model. (d) If you wanted to test whether washing the rice before cooking has any effect if the rice is cooked in a High amount of water, what is the null hypothesis? Give your answer in terms of β values. (e) Suppose you want to test whether the amount of water used to cook the rice makes any difference if the rice has been washed. What is the null hypothesis? Give your answer in terms of β values. (f) Averaging across different amounts of water used to cook the rice, does prewashing affect the amount of arsenic in the rice. What null hypothesis would you test to answer this question? Give your answer in terms of β values. (g) If you wanted to test whether the effect of the amount of water used to cook the rice depends on whether you wash it first, what is the null hypothesis? Give your answer in terms of β values. 5

17. Let s return to the 2x2 Factorial design example from lecture, and recall that we were trying to see if the effect of Factor A depended on the levels of Factor B. You are working with some hapless analyst who just tried to do two separate t-tests (for Factor A) across the two subgroups of Factor B, and you need to convince them that they really should have just tested the interaction. (a) Create a data frame with 40 students, 20 each of Male/Female, with half of each sex in Stats/Other programs. You should do this outside of your MC loop, as it doesn t need to be repeated. (b) Set the seed to 2015 and do 10,000 MC simulations of the following: i. Assign each student a score as follows: 55 + 5(if Female) + 15(if Stats) + N(0, 10). 10 is the SD, not variance To be clear, there is no interaction here, as the effects of Sex and Program are additive. ii. Do a two-sample t-test, checking if the levels of sex differ within each program, and get the p-value of the test. You have to do two tests; one for each program. iii. While you re here, do the proper ANOVA with an interaction, and store the p-value. (c) What proportion of the time did one t-test reject (at 5%), while the other did not? This proportion should be 5% (the Type I error rate) as there is no interaction. (d) What proportion of the time was the ANOVA interaction (falsely) significant? Give the hapless analyst a smack on the head! 6