Solutions Manual to Advanced Regression Models with SAS and R [1 ed.]


314 40 4MB

English Pages [340] Year 2019

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Solutions Manual to Advanced Regression Models with SAS and R [1 ed.]

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

SOLUTIONS MANUAL FOR Korosteleva, O. (2018). Advanced Regression Models with SAS and R, CRC Press By OLGA KOROSTELEVA Department of Mathematics and Statistics California State University, Long Beach

1

TABLE OF CONTENTS CHAPTER 1 ……………………………………………………………………………………. 3 CHAPTER 2 ……………………………………………………………………………………. 24 CHAPTER 3 ……………………………………………………………………………………. 58 CHAPTER 4 ……………………………………………………………………………………. 92 CHAPTER 5 ……………………………………………………………………………………. 131 CHAPTER 6 ……………………………………………………………………………………. 163 CHAPTER 7 ……………………………………………………………………………………. 187 CHAPTER 8 ……………………………………………………………………………………. 218 CHAPTER 9 ……………………………………………………………………………………. 284 CHAPTER 10 …………………………………………………………………………………. 315

2

CHAPTER 1 EXERCISE 1.1. Show that the normal distribution belongs to the exponential family of distributions. 𝑓(𝑦, 𝜇, 𝜎 ) = √

exp −

(

)

= exp − ln(2𝜋𝜎 ) −

(𝑦 − 2𝑦𝜇 + 𝜇 ) . Let 𝜃 = 𝜇

and 𝜙 = 𝜎 . Then, we can write 𝑓(𝑦, 𝜃, 𝜙) = exp − ln(2𝜋𝜙 ) −

= exp

− ln(2𝜋𝜙) −

( )

= exp

(𝑦 − 2𝑦𝜃 + 𝜃 )

+ ℎ(𝑦, 𝜙) where 𝑐(𝜃) =

, and

1 𝑦 ℎ(𝑦, 𝜙) = − ln(2𝜋𝜙) − . 2 2𝜙

EXERCISE 1.2. (a) Verify normality of the response variable, then fit the linear regression model to the data. State the fitted model. Give estimates for all parameters. In SAS: data weightloss; input drug$ age gender$ EWL cards; A 49 F 14.2 A 54 M 25.4 A A 34 F 15.9 A 51 F 17.4 A A 44 M 8.4 A 56 M 11.2 A B 51 M 21.9 B 44 F 23.6 B B 26 M 14.1 B 56 F 24.6 B B 52 F 15.7 B 54 F 23.7 ;

@@; 37 54 44 53 28

F F M F F

14.1 22.8 17.3 23.8 17.8

A A A B B

43 45 47 55 34

F F M M M

20.0 16.7 20.5 7.4 27.8

A A A B B

57 36 44 30 43

M M F F M

11.7 12.7 6.7 23.1 10.6

A A B B B

48 57 52 47 55

M M F M M

16.6 15.0 29.4 16.8 26.8

/*running normality check*/ proc univariate; var EWL; histogram/normal; run;

3

Goodness-of-Fit Tests for Normal Distribution Test Statistic p Value Kolmogorov-Smirnov D 0.10216310 Pr > D >0.150 Cramer-von Mises W-Sq 0.05103595 Pr > W-Sq >0.250 Anderson-Darling A-Sq 0.28788730 Pr > A-Sq >0.250

Based on the large p-values of the normality tests and the histogram, we can conclude that the response variable follows a normal distribution. /*fitting general linear model*/ proc genmod; class drug(ref="A") gender; model EWL = drug age gender / dist=normal link=identity; run; Log Likelihood -98.4395

Parameter Intercept drug drug age gender gender Scale

DF

B A F M

1 1 0 1 1 0 1

Analysis Of Maximum Likelihood Parameter Estimates Estimate Standard Wald 95% Confidence Wald Chi- Pr > ChiSq Error Limits Square 9.2146 5.3301 -1.2322 19.6614 2.99 0.0838 4.8103 1.8697 1.1456 8.4749 6.62 0.0101 0.0000 0.0000 0.0000 0.0000 . . 0.1102 0.1067 -0.0988 0.3192 1.07 0.3015 2.7235 1.8664 -0.9346 6.3815 2.13 0.1445 0.0000 0.0000 0.0000 0.0000 . . 5.2451 0.6556 4.1054 6.7012

The fitted model is 𝐸 (𝐸𝑊𝐿) = 9.2146 + 4.8103 ∙ 𝑑𝑟𝑢𝑔𝐵 + 0.1102 ∙ 𝑎𝑔𝑒 + 2.7235 ∙ 𝑓𝑒𝑚𝑎𝑙𝑒 , and 𝜎 = 5.2451. In R: weightloss.data0.250

P-values for the normality tests are all in excess of 0.05, indicating that normality holds. The histogram also displays a distribution close to bell-shaped. 7

/*fitting general linear model*/ proc genmod; class bodystyle(ref="hatchback") country(ref="Japan") leather(ref="no"); model priceK=bodystyle country hwy doors leather/dist=normal link=identity; run; Log Likelihood -67.2613

Parameter Intercept bodystyle bodystyle bodystyle country country country hwy doors leather leather Scale

Analysis Of Maximum Likelihood Parameter Estimates DF Estimate Standard Wald 95% Confidence Wald Chi- Pr > ChiSq Error Limits Square 1 5.1353 4.6900 -4.0570 14.3276 1.20 0.2735 coupe 1 2.2698 1.6836 -1.0301 5.5696 1.82 0.1776 sedan 1 6.4107 1.5477 3.3772 9.4441 17.16