This is a take-home exam. There are two problems worth a total of 100 points as indicated. You may use any books, notes, or Web resources that you like, but you may not discuss the questions or answers with anyone.
Submission instructions:
y = b1 + b2xto it. On return, the 2-vector b contains the parameters b1 and b2, and the scalar ra contains the adjusted coefficient of determination (explained below). info is an integer output flag that is 0 if the computation is successful and a nonzero value of your choice if an error occurs.
Use double-precision arithmetic (define the appropriate kind variables in your module). The contents of x and y must not be altered. Your code must call the LAPACK routine dgels with appropriate arguments to determine the coefficients and the residual sum of squares.
y = b1 exp(b2x).You should check that all the y's are nonzero and have the same sign. (If all are negative, then b1 is negative.)
Note that you can make a suitable change of variables to convert the exponential model into a linear one (and that you can call subroutine linear to fit it). On return, the parameters are as for linear, but ra holds the adjusted coefficient of determination as computed by linear for the transformed problem.
y = b1 + b2x + b3x2.On return, the 3-vector b contains the fitted parameters, and ra contains the adjusted coefficient of determination as usual.
1 - [(n - 1) / (n - p)] (SSE/SSTO)where SSE is the residual sum of squares and SSTO is the total sum of squares. Given the n-vector y (consisting of the measurements yi), the total sum of squares is
SSTO = yTy - n[E(y)]2where E(y) is the mean of the yi's.
The residual sum of squares, SSE, is the sum from i=1 to n of
[yi - b1 - b2xi]2that is, the sum of squares of the differences after the model is fit. (For the quadratic model, SSE is the sum of [yi - b1 - b2xi - b3xi2 ]2.)
Note that dgels computes SSE for you (read carefully the description of the return value of the argument B on the manual page).
For the linear and exponential models, p=2 since you're fitting only two parameters, b1 and b2. The quadratic model has p=3.
The rationale for the formula is as follows: You can exactly fit any collection of (x,y) data (as long as all the x's are distinct) by using a polynomial of sufficiently high degree. The adjusted sum of squares includes a penalty for an increasing number of terms.
The Intergovernmental Panel on Climate Change recently completed a report in which it estimates that at atmospheric CO2 concentration of 450 ppm would be dangerous, insofar as it might breach a climate "tipping point".
Although the carbon cycle is very complex, and extrapolations are always fraught with uncertainty, they nevertheless can provide a back-of-the-envelope estimate of how much time might be left to act on rising CO2 levels in the atmosphere. Use each of your models to estimate, to the nearest year, when the average CO2 level would reach 450 ppm, assuming that current trends continue.
tar cf midterm2.tar regression.f90 prob2.f90(and any other files that you generate) to generate a tar archive of your work.
Your_name Midterm 2Include the tar file as an attachment. Please also include your name as a comment in each file that you include in the tar file.