hw4.pdf - EE263 Homework 4 1 Fitting a model for hourly temperature You are given a set of temperature measurements(in degrees C yt \u2208 R t = 1 N taken

# hw4.pdf - EE263 Homework 4 1 Fitting a model for hourly...

This preview shows page 1 - 2 out of 5 pages.

EE263 Homework 41. Fitting a model for hourly temperature.You are given a set of temperature measure-ments (in degrees C),ytR,t= 1, . . . , N, taken hourly over one week (soN= 168). Anexpert says that over this week, an appropriate model for the hourly temperature is a trend(i.e., a linear function oft) plus a diurnal component (i.e., a24-periodic component):ˆyt=at+pt,whereaRandpRNsatisfiespt+24=pt, fort= 1, . . . , N-24.We can interpreta(which has units of degrees C per hour) as the warming or cooling trend (fora >0ora <0,respectively) over the week.a) Explain how to findaRandpRN(which is24-periodic) that minimize the RMSvalue ofy-ˆy.b) Carry out the procedure described in part (a) on the data set found intempfit_data.json.Give the value of the trend parameterathat you find. Plot the modelˆyand the measuredtemperaturesyon the same plot. (The matlab code to do this is in the data file, butcommented out.)c)Temperature prediction.Use the model found in part (b) to predict the temperature forthe next24-hour period (i.e., fromt= 169tot= 192). The filetempfit_data.jsonalso contains a24long vectorytomwith tomorrow’s temperatures.Plot tomorrow’stemperature and your prediction of it, based on the model found in part (b), on the sameplot. What is the RMS value of your prediction error for tomorrow’s temperatures?2. Leave-one-out cross-validation.Consider the standard measurement setupy=Ax+,wherexRnis an unknown vector of parameters,yRmis a vector of measurements,ARm×nis a known measurement matrix, andRmis an unknown error vector.Weassume thatm > n, so there are strictly more observations than unknown parameters. LetˆxRnbe the least-squares estimate ofx, andr=y-Aˆxbe the vector of least-squaresresiduals. The squared fitting error,mi=1r2i, gives an overly optimistic estimate of how wellthe model describes the data. A more accurate estimate of the performance of the model canbe obtained using leave-one-out cross-validation (LOOCV). The LOOCV squared fitting erroris obtained as follows.Let˜AiR(m-1)×nbe the matrix obtained by removing theith row fromA,˜yiRm-1be the vector obtained by removing theith component fromy,˜xi=˜Ai˜yiRnbe the least-squares estimate obtained using all of the measurementsexcept for theith measurement, and˜ri=yi-Ai*˜xiRbe the fitting error for theith measurement using˜xias the estimateofx.

#### You've reached the end of your free preview.

Want to read all 5 pages?

• Spring '19
• Hassan Kasfy

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern