Use linear regression to find $k$ and $C$ for $PV^k = C$

1.3k Views Asked by At

I got a problem. I got a task like this:

The table below contains data on the pressure of $P$ and the volume $V$ of certain constant mass of gas. The equation that combines these two values is $PV^k = C$, where $k$ and $C$ are some constants.

$V: 54.3 | 61.8 | 72.4 | 88.7 | 118.6 | 194.0$

$P: 61.2 | 49.5 | 37.6 | 28.4 | 19.2 | 10.1$

Using linear regression find values of $C$ and $k$. What is the predicted value of $P$ when $V = 100$?

I found the linear regression function : $$p = -0.32v - 65.81$$ And I don't know how to use it to find $k$ and $C$. Any tips or ideas?

2

There are 2 best solutions below

6
On BEST ANSWER

$P$ and $V$ need not be related in a linear fashion.

$$PV^k=C$$

$$P=CV^{-k}$$

$$\ln P = -k \ln V + \ln C$$

We can see that $\ln P$ and $\ln V$ are related in a linear fashion.

Try to fit a linear regression between $\ln P$ and $\ln V$ and recover $k$ and $C$.

0
On

Too long for a comment added for your curiosity.

Sorry to be the spoilsport here but take care with this kind of problem.

As Siong Thye Goh answered, linearizing the problem gives the parameters and this is what you have been asked for. But, these are only estimates of the best parameters.

So, once you have obtain these estimates, in order to be strict, you should need to minimize the real sum of squares which is $$SSQ=\frac 12\sum_{i=1}^6 (P_i\,V_i^k-C)^2$$ Taking derivatives $$\frac{\partial SSQ}{\partial k}=\sum_{i=1}^6 P_i\, V_i^k \log (V_i) \left(P_i\, V_i^k-C\right)=0\tag 1$$ $$\frac{\partial SSQ}{\partial C}=-\sum_{i=1}^6 \left(P_i\, V_i^k-C\right)=0\tag 2$$

From $(2)$,we get $$C=\frac 16 \sum_{i=1}^6 P_i\, V_i^k$$ which can be plugged in $(1)$ to get a nasty equation in $k$ to be solved using graphics (and may be polished using Newton method).

Using your data, this would lead to $k=1.37855$ and $C=14243.1$ which are quite different from those obtained in the preliminary step.