ST790R -- Fall 2009 Homework #5 -- due Tuesday, 27 October 2009 (last edited Tuesday, 20 October) Exercises in Textbook: (*just turn in these) 8.7, 8.8, 8.13, 9.13*, 9.14, 9.15* R Exercises: *1) (Variation on 8.8) Consider maximizing the function f(t) = y*t - n*log(1+exp(t)) for n=3 and y=2. a) Find the root of the derivative of f(t) using "uniroot." b) Find the maximum of f(t) using "optimize." c) Write a function h(t) that computes the Newton step, with t0 as its argument and returning the result of a Newton step t1. d) Find the maximum of f(t) using Newton's method. e) Find the three (oops, not 2) points where h(h(t))=t. f) Graph h(h(t)) vs t near the two outer points. d) Argue that if we use a starting value outside the interval formed by those two points in (e), then Newton will diverge. *2) Fit a nonlinear regression model to the data in one of the files "sub1.dat" through "sub10.dat" using the last digit of your NCSU id. The files are in the directory "yafune" and are times (ti)(hours) and drug concentrations (yi)(ng/ml) for subjects in a Phase I trial. Fit a model of the form log(yi) dist Normal(log(f(ti)), sigma^2) where / a(1-exp(-bt))+c*(1-exp(-dt)) for t <= T=3 f(t) = { \ a(1-exp(-bT))exp(-b(t-T))+c(1-exp(-dT))exp(-d(t-T)) for t > T=3. Note that if we define m(t) = min(t,T), then we can rewrite f(t) in one line as f(t) = a(1-exp(-bm(t)))exp(-b(t-m(t))) + c(1-exp(-dm(t)))exp(-d(t-m(t))) Note that getting starting values can be a challenge. Let b > d so that the first term decays more quickly. So for large values of t, fit just the second term -- just a simple linear regression. Then adjust the response and fit the first few observations for the first piece. Some options: a) instead of logs, fit yi dist Normal( f(ti), sigma^2 ) b) another dataset -- there are more subjects