Given a steam table consisting of (T, P), we want to regress P (pressure) again T (temperature) to uncover a relationship between P and T. Steam is by far the most important chemical, and there is an incentive to be able to describe its property well. The following is a series of regression schemes in increasing degree of sophistication.
P = a0*1 + a1*T1 + a2*T2 + a3*T3 + a4*T4 + ...
P = exp(A-B/(T+C))
P = a1*L1(T) + a2*L2(T) + a3*L3(T) + a4*L4(T) + ...
P = a1*score1 + a2*score2 + a3*score3 + a4*score4 + ...
Problem Statement: Polynomial -- Power Series Basis Functions. Find a polynomial via regression that best describes the steam data.
Solution:
Problem Statement: Nonlinear Regression. Thermodynamics says the saturation pressure (P) of a chemical species should depend exponentially on temperature (T) according to the following Antoine equation.
P = exp(A-B/(T+C))where the constants A, B, and C are called Antoine coefficients. Find these coefficients for water by regressing the steam data.
Solution:
Strictly speaking, we should regress P, which is the dependent
variable, against exp(A-B/(T+C)). The values of the
regression coefficients are distorted if we regress ln(P)
against A-B/(T+C).
Nonlinear Regression (Antoine Equation) by Minimizing sse
Problem Statement: Orthogonal Basis Functions. Approximate the vector of saturated steam pressure (not the logarithm of pressure) with a linear combination of Legendre polynomials gi. Use as many terms as necessary to describe adequately the given steam data.
P(x)=a1*g1+a2*g2+...+am*gm
=Si=1m ai*gi
Note that ai*gi is the projection of the vector P onto the vector gi
Projection of P onto gi = ai*gi = (P,gi)/(gi,gi)*giThus, the coefficient ai is
ai = (P,gi)/(gi,gi)
Solution:
We can do just as a good job whether we express the given vector
y in terms of (1, x, x^2,...), which are not orthogonal, as we
would with orthogonal vectors. Legendre polynomials are
orthogonal in x=[-1 1] only because of a very specific definition
of a scalar product between two functions. Do not mix vectors
that are functions with vectors that are columns of numbers. We
define a different scalar product for vectors that are columns of
numbers. Although Legendre polynomials are orthogonal, the
columns of numbers formed with Legendre polynomials are only
roughly, but not exactly, orthogonal. Thus, the regression
coefficients are off when they are calculated from a formulae
that is valid strictly for orthogonal vectors. As a result,
there is a noticeable difference between the given pressure and
the approximation.
Problem Statement: Eigenvalue-Eigenvector Approach. Generate the following independent matrix X from the steam pressure versus temperature data (steam.prn).
X=[1 T T2 ... T9]Because high powers of T (e.g., T9 at T=600) can be quite large, and because these large numbers may mess up your calculation, you may want to center T around the mean value and rescale T with the standard deviation of T so that the new scaled T is roughly of order 1, i.e., T~[-1 1]. Find the eigenvalues for the square matrix XTX and list them in decreasing order. Also find the associated normalized eigenvectors, V1, V2, V3.... How many independent eigenvectors are there? Show that all of these eigenvectors are mutually orthogonal (i.e., ViT*Vi=1 for i=j, VT*V=I). (Note that XTX is a matrix of scalar products of 1, T, T2,T3,...) Express P as a linear combination of X expressed along the mutually orthogonal eigenvectors, score1, score2, score3,... (i.e., scorei=X*Vi)
P = a1*score1 + a2*score2 + a3*score3 + a4*score4 + ...Find the coefficients. How many terms to you need to adequately describe P? Note that ai*scorei is the projection of the vector P onto the vector scorei
Projection of P onto scorei = ai*scorei = (P,scorei)/(scorei,scorei)*scoreiThus, the coefficient ai is
ai = (P,scorei)/(scorei,scorei) ai = (P,scorei) if scorei is normalized, i.e., (scorei,scorei)=1Finally, provide the regression equation P(T) to predict P from T.
Solution:
Regression of Steam Pressure /w Eigenvectors
|