Engineering Background: In modeling an oil reservoir in petroleum engineering, i
ID: 3574505 • Letter: E
Question
Engineering Background: In modeling an oil reservoir in petroleum engineering, it may be necessary to Find a relationship between the equilibrium constant of a reaction and the pressure at a constant temperature. The data shown in the table below relates equilibrium constants K to pressure (measured in 1000 psia). Theory says that the K-P relationship should be exponential: K = Aexp(BP) You can take the log-transform of both sides to get a linear form that will allow you to use linear regression to Find A and B: logK = logA + BP so the slope of the regression is B, and A is equal to the exponential raised to the intercept. You want to compare this linear regression on the transformed data with a polynomial regression on the untransformed data. Specifically, you want to Find what order of polynomial regression you need to do to get a better fit in the mean-squared-error sense than the log-transformed linear regression. A step-by-step set of instructions on what to do is as follows: Do a linear regression of P vs logK using polyfit, Transform the intercept value using the exponential function, and Find K f it = cap Aexp (cap B P) where cap A and cap B are the regression-estimated parameters. Find the MSE for this regression using measured K values and Kfit. Now perform a linear regression (polynomial regression of order 1) on the untransformed data using polyfit. Using the results of polyfit, Find the best fit line, Kfit. It may be easiest to calculate Kfit using polyyal. Find the MSE for this regression using measured K values and Kfit. Increase the order of the polynomial regression by 1 (use a loop), and repeat from step 4. Stop this loop when the MSE you Find in step 6 is less than the MSE you found in step 3. This will tell you what order of polynomial regression gives a better fit than log-transformed linear regression.Explanation / Answer
Let K and P are two variable where K is dependent variable and P is independent variable. K and P are exponatially related.
k=Ae^{BP} \
we know that exponatial model can be reduced after taking Log both side the model becomes a linear model with parameter log(A) and B parameter.
log(k)=log(A) + {BP} \
here we use the matalb Software and calculation is as follows
1. Yes, P and log(K) are linear relationship between them so we fit the model using polyfit (x,y, n=1)
x=[0.6,5.89;1,4.68;1.4,4.1;1.8,3.45;2.2,3.25;2.6,2.69;3,2.25;3.4,1.92;3.8,1.55;4.2,1.45;4.6,1.19;5.0,0.99;5.4,0.84];
p = polyfit(x(:,1),x(:,2),1)
>> p
p =
-0.3959 1.9873
2.
log(A) = 1.9873 i.e A = exp(1.9873) = 7.2958
and Kfit is calculated using polyval() function
kfit = polyval(p,x(:,1));
kfit =
1.7498
1.5915
1.4331
1.2748
1.1164
0.9581
0.7997
0.6414
0.4831
0.3247
0.1664
0.0080
-0.1503
3. MSE of the k and kfit value is
Residuals= x(:,2)-kfit
MSE=(Residuals'*Residuals)/ length(Residuals)
MSE is 4.2470 .
4. now we perform the regression line without transformation of the K value
x=[0.6,5.89;1,4.68;1.4,4.1;1.8,3.45;2.2,3.25;2.6,2.69;3,2.25;3.4,1.92;3.8,1.55;4.2,1.45;4.6,1.19;5.0,0.99;5.4,0.84];
p = polyfit(x(:,1),x(:,2),1)
p =
-0.9692 5.5423
5. After getting the coefficient of the best linear model in the above section, here dependent variable is not transformed . we calculate the kfit
>> kfit = polyval(p,x(:,1));
>> kfit
kfit =
4.9608
4.5731
4.1854
3.7977
3.4100
3.0223
2.6346
2.2469
1.8592
1.4715
1.0838
0.6962
0.3085
6. we calculate the MSE of the k and kfit in the case of without transformed
Residuals= x(:,2)-kfit
MSE=(Residuals'*Residuals)/ length(Residuals)
MSE =
0.1439
7. as compared with the exponatial model the liner model gives the better result on the basis of MSE. MSE of the without transformrd of K gives the better result.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.