曲線回帰を本当はPythonで解きたいけど表計算で解けと言われたので



<a href="https://qiita.com/maskot1977/items/97b3c3f0f3d35d5f162a">線形回帰を本当はPythonで解きたいけど表計算で解けと言われたので</a> と <a href="https://qiita.com/maskot1977/items/f32e1c887d0f2e4ec8f7">線形重回帰を本当はPythonで解きたいけど表計算で解けと言われたので</a> の続編です。前の記事を読んでもらっていれば、曲線に回帰するのは簡単。

# 用いるデータ

<a href="http://mh.rgr.jp/memo/mq0111.htm" target="_blank">分子性物質のデータ（融点・沸点）</a>


```python
import pandas as pd
data = [['HF', 19.5, 20.0],
        ['HCl', -84.9, 36.5],
        ['HBr', -67.0, 80.9],
        ['HI', -35.1, 127.9],
        ['H2O', 100.0, 18.0],
        ['H2S', -60.7, 34.1],
        ['H2Se', -42, 81.0],
        ['H2Te', -1.8, 129.6],
        ['NH3', -33.4, 17.0],
        ['PH3', -87, 34.0],
        ['AsH3', -55, 77.9],
        ['SbH3', -17.1, 124.8],
        ['CH4', -161.49, 16.0],
        ['SiH4', -111.8, 32.1],
        ['GeH4', -90, 76.6],
        ['SnH4', -52, 122.7],
        ['He', -268.934, 4.0],
        ['Ne', -246.048, 20.2],
        ['Ar', -185.7, 39.9],
        ['Kr', -152.3, 83.8],
        ['Xe', -108.1, 131.3],
       ]
df = pd.DataFrame(data, columns = ['molecule', 'boiling point', 'molecular weight'])
df
```




<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
    </tr>
  </tbody>
</table>
</div>




```python
X = df.loc[:, ['molecular weight']].as_matrix()
X
```




    array([[  20. ],
           [  36.5],
           [  80.9],
           [ 127.9],
           [  18. ],
           [  34.1],
           [  81. ],
           [ 129.6],
           [  17. ],
           [  34. ],
           [  77.9],
           [ 124.8],
           [  16. ],
           [  32.1],
           [  76.6],
           [ 122.7],
           [   4. ],
           [  20.2],
           [  39.9],
           [  83.8],
           [ 131.3]])




```python
Y = df['boiling point'].as_matrix()
Y
```




    array([  19.5  ,  -84.9  ,  -67.   ,  -35.1  ,  100.   ,  -60.7  ,
            -42.   ,   -1.8  ,  -33.4  ,  -87.   ,  -55.   ,  -17.1  ,
           -161.49 , -111.8  ,  -90.   ,  -52.   , -268.934, -246.048,
           -185.7  , -152.3  , -108.1  ])




```python
%matplotlib inline
import matplotlib.pyplot as plt
# 散布図
plt.figure(figsize=(8,6))
plt.scatter(X, Y, alpha=0.3)
for name, x, y in zip(df.loc[:, ['molecule']].as_matrix(), X, Y):
    plt.text(x, y, name[0], size=8)
plt.xlabel('molecular weight')
plt.ylabel('boiling point')
plt.grid()
plt.show()
```


![曲線回帰を本当はPythonで解きたいけど表計算で解けと言われたので_4_0.png](https://qiita-image-store.s3.amazonaws.com/0/211162/7e897841-1b4f-ab80-ff01-e2e0dcd50b60.png)



```python
import math
import numpy as np
logX = np.array([[math.log(x)] for x in X[:,0]])
```


```python
logX
```




    array([[ 2.99573227],
           [ 3.59731226],
           [ 4.39321382],
           [ 4.85124871],
           [ 2.89037176],
           [ 3.52929738],
           [ 4.39444915],
           [ 4.86445278],
           [ 2.83321334],
           [ 3.52636052],
           [ 4.35542595],
           [ 4.82671246],
           [ 2.77258872],
           [ 3.46885603],
           [ 4.33859708],
           [ 4.80974235],
           [ 1.38629436],
           [ 3.0056826 ],
           [ 3.68637632],
           [ 4.42843301],
           [ 4.87748478]])



# まずは一番便利な scikit-learn から


```python
from sklearn import linear_model
lr = linear_model.LinearRegression()
```


```python
lr.fit(logX, Y)
```




    LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)




```python
# 回帰係数
lr.coef_
```




    array([ 33.87205496])




```python
# 切片
lr.intercept_
```




    -211.66384118386563




```python
print("y = f(x) = wlogx + t; (w, t) = ({0}, {1})".format(lr.coef_[0], lr.intercept_))
```

    y = f(x) = wlogx + t; (w, t) = (33.872054963641745, -211.66384118386563)



```python
# 決定係数R2
lr.score(logX, Y)
```




    0.13487033631665779




```python
%matplotlib inline
import matplotlib.pyplot as plt
# 散布図
plt.figure(figsize=(5,4))
plt.scatter(X, Y, alpha=0.3)
 
# 回帰直線
plt.plot(sorted(X), sorted(lr.predict(logX)))
for name, x, y in zip(df.loc[:, ['molecule']].as_matrix(), X, Y):
    plt.text(x, y, name[0], size=8)
plt.xlabel('molecular weight')
plt.ylabel('boiling point')
plt.grid()
plt.show()
```


![曲線回帰を本当はPythonで解きたいけど表計算で解けと言われたので_14_0.png](https://qiita-image-store.s3.amazonaws.com/0/211162/a4783e93-9c72-cf3f-aaf8-e4f98a616b2e.png)


# 次は、ガチPythonで。


```python
# 平均値を求める関数
def mean(list):
    sum = 0
    for x in list:
        sum += x
    return sum / len(list)
```


```python
# 分散を求める関数
def variance(list):
    ave = mean(list)
    sum = 0
    for x in list:
        sum += (x - ave) ** 2
    return sum / len(list)
```


```python
# 標準偏差を求める関数
import math
def standard_deviation(list):
    return math.sqrt(variance(list))
```


```python
# 共分散 = 偏差積の平均
def covariance(list1, list2): 
    mean1 = mean(list1)
    mean2 = mean(list2)
    sum = 0
    for d1, d2 in zip(list1, list2):
        sum += (d1 - mean1) * (d2 - mean2)
    return sum / len(list1)
```


```python
# 相関係数 = 共分散を list1, list2 の標準偏差で割ったもの
def correlation(list1, list2):
    return covariance(list1, list2) / (standard_deviation(list1) * standard_deviation(list2))
```


```python
# 回帰直線の傾き＝相関係数＊（（yの標準偏差）／（xの標準偏差））
def w_fit(xlist, ylist):
    return correlation(xlist, ylist) * standard_deviation(ylist) / standard_deviation(xlist)
```


```python
# y切片＝yの平均－（傾き＊xの平均）
def t_fit(xlist, ylist):
    return mean(ylist) - w_fit(xlist, ylist) * mean(xlist)
```


```python
# 回帰直線の式を表示
w = w_fit(logX, Y)
t = t_fit(logX, Y)
print("y = f(x) = wlogx + t; (w, t) = ({0}, {1})".format(w, t))
```

    y = f(x) = wlogx + t; (w, t) = ([ 33.87205496], [-211.66384118])



```python
# 回帰直線の式を関数として表現
def f(x):
    return w * x + t
```


```python
# 決定係数R2
def r2(xlist, ylist):
    wa1 = 0.
    wa2 = 0.
    for x, y in zip(xlist, ylist):
        wa1 += (y - f(x))**2
        wa2 += (y - mean(ylist))**2
    return 1. - wa1 / wa2
```


```python
r2(logX, Y)
```




    array([ 0.13487034])



# さて、表計算で解けと言われたので pandas で書いてみましょうか。


```python
import copy
from IPython.display import display
excel = copy.deepcopy(df)
excel
```




<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
    </tr>
  </tbody>
</table>
</div>




```python
excel['y'] = excel['boiling point']
excel['x'] = excel['molecular weight']
excel['log(x)'] = [math.log(x) for x in excel['x']]
mean_y = mean(excel['y'])
mean_logx = mean(excel['log(x)'])
display(excel, pd.DataFrame([[mean_y, mean_logx]], columns=['y','log(x)'], index=['mean']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
  </tbody>
</table>
</div>



```python
excel['y-mean(y)'] = [y - mean_y for y in excel['y']]
excel['log(x)-mean(log(x))'] = [logx - mean_logx for logx in excel['log(x)']]
display(excel, pd.DataFrame([[mean_y, mean_logx]], columns=['y','log(x)'], index=['mean']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
  </tbody>
</table>
</div>



```python
excel['(y-mean(y))**2'] = [sa ** 2 for sa in excel['y-mean(y)']]
excel['(log(x)-mean(log(x)))**2'] = [sa ** 2 for sa in excel['log(x)-mean(log(x))']]
display(excel, pd.DataFrame([[mean_y, mean_logx]], columns=['y','log(x)'], index=['mean']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
  </tbody>
</table>
</div>



```python
variance_y = mean(excel['(y-mean(y))**2'])
variance_logx = mean(excel['(log(x)-mean(log(x)))**2'])
sd_y = math.sqrt(variance_y)
sd_logx = math.sqrt(variance_logx)
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



```python
excel['(y-mean(y)) * (log(x)-mean(log(x)))'] = excel['y-mean(y)'] * excel['log(x)-mean(log(x))']
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



```python
covar_logxy = mean(excel['(y-mean(y)) * (log(x)-mean(log(x)))'])
corr_logxy = covar_logxy / (sd_logx * sd_y)
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']),
       pd.DataFrame([covar_logxy, corr_logxy], index=['covariance', 'correlation'], columns=['log(x),y']))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>log(x),y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>covariance</th>
      <td>28.073248</td>
    </tr>
    <tr>
      <th>correlation</th>
      <td>0.367247</td>
    </tr>
  </tbody>
</table>
</div>



```python
w = corr_logxy * sd_y / sd_logx
t = mean_y - w * mean_logx
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y', 'log(x)'], index=['mean', 'variance', 'sd']),
        pd.DataFrame([covar_logxy, corr_logxy], index=['covariance', 'correlation'], columns=['log(x),y']),
        pd.DataFrame([[w, t]], columns=["w", "t"], index=["y = f(x) = wlog(x) + t"]))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>log(x),y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>covariance</th>
      <td>28.073248</td>
    </tr>
    <tr>
      <th>correlation</th>
      <td>0.367247</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>w</th>
      <th>t</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>y = f(x) = wlog(x) + t</th>
      <td>33.872055</td>
      <td>-211.663841</td>
    </tr>
  </tbody>
</table>
</div>



```python
# 回帰直線の式を関数として表現
def f(x):
    return w * x + t
```


```python
excel['f(x)'] = f(excel['log(x)'])
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']),
        pd.DataFrame([covar_logxy, corr_logxy], index=['covariance', 'correlation'], columns=['log(x),y']),
        pd.DataFrame([[w, t]], columns=["w", "t"], index=["y = f(x) = wlog(x) + t"]))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
      <th>f(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
      <td>-110.192233</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
      <td>-89.815483</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
      <td>-62.856661</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
      <td>-47.342078</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
      <td>-113.761010</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
      <td>-92.119286</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
      <td>-62.814818</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
      <td>-46.894829</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
      <td>-115.697083</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
      <td>-92.218764</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
      <td>-64.136614</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
      <td>-48.173172</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
      <td>-117.750564</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
      <td>-94.166559</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
      <td>-64.706643</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
      <td>-48.747984</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
      <td>-164.707202</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
      <td>-109.855195</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
      <td>-86.798700</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
      <td>-61.663715</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
      <td>-46.453409</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>log(x),y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>covariance</th>
      <td>28.073248</td>
    </tr>
    <tr>
      <th>correlation</th>
      <td>0.367247</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>w</th>
      <th>t</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>y = f(x) = wlog(x) + t</th>
      <td>33.872055</td>
      <td>-211.663841</td>
    </tr>
  </tbody>
</table>
</div>



```python
excel['(y-f(x))**2'] = (excel['y'] - excel['f(x)'])**2
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']),
        pd.DataFrame([covar_logxy, corr_logxy], index=['covariance', 'correlation'], columns=['log(x),y']),
        pd.DataFrame([[w, t]], columns=["w", "t"], index=["y = f(x) = wlog(x) + t"]))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
      <th>f(x)</th>
      <th>(y-f(x))**2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
      <td>-110.192233</td>
      <td>16820.075290</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
      <td>-89.815483</td>
      <td>24.161969</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
      <td>-62.856661</td>
      <td>17.167258</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
      <td>-47.342078</td>
      <td>149.868481</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
      <td>-113.761010</td>
      <td>45693.769454</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
      <td>-92.119286</td>
      <td>987.171545</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
      <td>-62.814818</td>
      <td>433.256643</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
      <td>-46.894829</td>
      <td>2033.543613</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
      <td>-115.697083</td>
      <td>6772.809882</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
      <td>-92.218764</td>
      <td>27.235494</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
      <td>-64.136614</td>
      <td>83.477714</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
      <td>-48.173172</td>
      <td>965.541992</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
      <td>-117.750564</td>
      <td>1913.138297</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
      <td>-94.166559</td>
      <td>310.938239</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
      <td>-64.706643</td>
      <td>639.753932</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
      <td>-48.747984</td>
      <td>10.575609</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
      <td>-164.707202</td>
      <td>10863.225340</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
      <td>-109.855195</td>
      <td>18548.480187</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
      <td>-86.798700</td>
      <td>9781.467196</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
      <td>-61.663715</td>
      <td>8214.936167</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
      <td>-46.453409</td>
      <td>3800.302233</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>log(x),y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>covariance</th>
      <td>28.073248</td>
    </tr>
    <tr>
      <th>correlation</th>
      <td>0.367247</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>w</th>
      <th>t</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>y = f(x) = wlog(x) + t</th>
      <td>33.872055</td>
      <td>-211.663841</td>
    </tr>
  </tbody>
</table>
</div>



```python
r2 = 1. - sum(excel['(y-f(x))**2']) / sum(excel['(y-mean(y))**2'])
display(excel, pd.DataFrame([[mean_y, mean_logx], [variance_y, variance_logx], [sd_y, sd_logx]], 
                            columns=['y','log(x)'], index=['mean', 'variance', 'sd']),
        pd.DataFrame([covar_logxy, corr_logxy], index=['covariance', 'correlation'], columns=['log(x),y']),
        pd.DataFrame([[w, t, r2]], columns=["w", "t", "R2"], index=["y = f(x) = wlog(x) + t"]))
```


<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>molecule</th>
      <th>boiling point</th>
      <th>molecular weight</th>
      <th>y</th>
      <th>x</th>
      <th>log(x)</th>
      <th>y-mean(y)</th>
      <th>log(x)-mean(log(x))</th>
      <th>(y-mean(y))**2</th>
      <th>(log(x)-mean(log(x)))**2</th>
      <th>(y-mean(y)) * (log(x)-mean(log(x)))</th>
      <th>f(x)</th>
      <th>(y-f(x))**2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>HF</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>19.500</td>
      <td>20.0</td>
      <td>2.995732</td>
      <td>102.398667</td>
      <td>-0.805784</td>
      <td>10485.486935</td>
      <td>0.649288</td>
      <td>-82.511226</td>
      <td>-110.192233</td>
      <td>16820.075290</td>
    </tr>
    <tr>
      <th>1</th>
      <td>HCl</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>-84.900</td>
      <td>36.5</td>
      <td>3.597312</td>
      <td>-2.001333</td>
      <td>-0.204204</td>
      <td>4.005335</td>
      <td>0.041699</td>
      <td>0.408681</td>
      <td>-89.815483</td>
      <td>24.161969</td>
    </tr>
    <tr>
      <th>2</th>
      <td>HBr</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>-67.000</td>
      <td>80.9</td>
      <td>4.393214</td>
      <td>15.898667</td>
      <td>0.591697</td>
      <td>252.767602</td>
      <td>0.350106</td>
      <td>9.407199</td>
      <td>-62.856661</td>
      <td>17.167258</td>
    </tr>
    <tr>
      <th>3</th>
      <td>HI</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>-35.100</td>
      <td>127.9</td>
      <td>4.851249</td>
      <td>47.798667</td>
      <td>1.049732</td>
      <td>2284.712535</td>
      <td>1.101938</td>
      <td>50.175802</td>
      <td>-47.342078</td>
      <td>149.868481</td>
    </tr>
    <tr>
      <th>4</th>
      <td>H2O</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>100.000</td>
      <td>18.0</td>
      <td>2.890372</td>
      <td>182.898667</td>
      <td>-0.911145</td>
      <td>33451.922268</td>
      <td>0.830185</td>
      <td>-166.647151</td>
      <td>-113.761010</td>
      <td>45693.769454</td>
    </tr>
    <tr>
      <th>5</th>
      <td>H2S</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>-60.700</td>
      <td>34.1</td>
      <td>3.529297</td>
      <td>22.198667</td>
      <td>-0.272219</td>
      <td>492.780802</td>
      <td>0.074103</td>
      <td>-6.042901</td>
      <td>-92.119286</td>
      <td>987.171545</td>
    </tr>
    <tr>
      <th>6</th>
      <td>H2Se</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>-42.000</td>
      <td>81.0</td>
      <td>4.394449</td>
      <td>40.898667</td>
      <td>0.592933</td>
      <td>1672.700935</td>
      <td>0.351569</td>
      <td>24.250157</td>
      <td>-62.814818</td>
      <td>433.256643</td>
    </tr>
    <tr>
      <th>7</th>
      <td>H2Te</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>-1.800</td>
      <td>129.6</td>
      <td>4.864453</td>
      <td>81.098667</td>
      <td>1.062936</td>
      <td>6576.993735</td>
      <td>1.129834</td>
      <td>86.202719</td>
      <td>-46.894829</td>
      <td>2033.543613</td>
    </tr>
    <tr>
      <th>8</th>
      <td>NH3</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>-33.400</td>
      <td>17.0</td>
      <td>2.833213</td>
      <td>49.498667</td>
      <td>-0.968303</td>
      <td>2450.118002</td>
      <td>0.937611</td>
      <td>-47.929713</td>
      <td>-115.697083</td>
      <td>6772.809882</td>
    </tr>
    <tr>
      <th>9</th>
      <td>PH3</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>-87.000</td>
      <td>34.0</td>
      <td>3.526361</td>
      <td>-4.101333</td>
      <td>-0.275156</td>
      <td>16.820935</td>
      <td>0.075711</td>
      <td>1.128506</td>
      <td>-92.218764</td>
      <td>27.235494</td>
    </tr>
    <tr>
      <th>10</th>
      <td>AsH3</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>-55.000</td>
      <td>77.9</td>
      <td>4.355426</td>
      <td>27.898667</td>
      <td>0.553909</td>
      <td>778.335602</td>
      <td>0.306816</td>
      <td>15.453336</td>
      <td>-64.136614</td>
      <td>83.477714</td>
    </tr>
    <tr>
      <th>11</th>
      <td>SbH3</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>-17.100</td>
      <td>124.8</td>
      <td>4.826712</td>
      <td>65.798667</td>
      <td>1.025196</td>
      <td>4329.464535</td>
      <td>1.051027</td>
      <td>67.456530</td>
      <td>-48.173172</td>
      <td>965.541992</td>
    </tr>
    <tr>
      <th>12</th>
      <td>CH4</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>-161.490</td>
      <td>16.0</td>
      <td>2.772589</td>
      <td>-78.591333</td>
      <td>-1.028928</td>
      <td>6176.597675</td>
      <td>1.058692</td>
      <td>80.864803</td>
      <td>-117.750564</td>
      <td>1913.138297</td>
    </tr>
    <tr>
      <th>13</th>
      <td>SiH4</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>-111.800</td>
      <td>32.1</td>
      <td>3.468856</td>
      <td>-28.901333</td>
      <td>-0.332660</td>
      <td>835.287068</td>
      <td>0.110663</td>
      <td>9.614330</td>
      <td>-94.166559</td>
      <td>310.938239</td>
    </tr>
    <tr>
      <th>14</th>
      <td>GeH4</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>-90.000</td>
      <td>76.6</td>
      <td>4.338597</td>
      <td>-7.101333</td>
      <td>0.537081</td>
      <td>50.428935</td>
      <td>0.288456</td>
      <td>-3.813988</td>
      <td>-64.706643</td>
      <td>639.753932</td>
    </tr>
    <tr>
      <th>15</th>
      <td>SnH4</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>-52.000</td>
      <td>122.7</td>
      <td>4.809742</td>
      <td>30.898667</td>
      <td>1.008226</td>
      <td>954.727602</td>
      <td>1.016519</td>
      <td>31.152836</td>
      <td>-48.747984</td>
      <td>10.575609</td>
    </tr>
    <tr>
      <th>16</th>
      <td>He</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>-268.934</td>
      <td>4.0</td>
      <td>1.386294</td>
      <td>-186.035333</td>
      <td>-2.415222</td>
      <td>34609.145248</td>
      <td>5.833298</td>
      <td>449.316648</td>
      <td>-164.707202</td>
      <td>10863.225340</td>
    </tr>
    <tr>
      <th>17</th>
      <td>Ne</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>-246.048</td>
      <td>20.2</td>
      <td>3.005683</td>
      <td>-163.149333</td>
      <td>-0.795834</td>
      <td>26617.704967</td>
      <td>0.633352</td>
      <td>129.839763</td>
      <td>-109.855195</td>
      <td>18548.480187</td>
    </tr>
    <tr>
      <th>18</th>
      <td>Ar</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>-185.700</td>
      <td>39.9</td>
      <td>3.686376</td>
      <td>-102.801333</td>
      <td>-0.115140</td>
      <td>10568.114135</td>
      <td>0.013257</td>
      <td>11.836560</td>
      <td>-86.798700</td>
      <td>9781.467196</td>
    </tr>
    <tr>
      <th>19</th>
      <td>Kr</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>-152.300</td>
      <td>83.8</td>
      <td>4.428433</td>
      <td>-69.401333</td>
      <td>0.626917</td>
      <td>4816.545068</td>
      <td>0.393024</td>
      <td>-43.508844</td>
      <td>-61.663715</td>
      <td>8214.936167</td>
    </tr>
    <tr>
      <th>20</th>
      <td>Xe</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>-108.100</td>
      <td>131.3</td>
      <td>4.877485</td>
      <td>-25.201333</td>
      <td>1.075968</td>
      <td>635.107202</td>
      <td>1.157708</td>
      <td>-27.115836</td>
      <td>-46.453409</td>
      <td>3800.302233</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>y</th>
      <th>log(x)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>mean</th>
      <td>-82.898667</td>
      <td>3.801516</td>
    </tr>
    <tr>
      <th>variance</th>
      <td>7050.465101</td>
      <td>0.828803</td>
    </tr>
    <tr>
      <th>sd</th>
      <td>83.967048</td>
      <td>0.910386</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>log(x),y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>covariance</th>
      <td>28.073248</td>
    </tr>
    <tr>
      <th>correlation</th>
      <td>0.367247</td>
    </tr>
  </tbody>
</table>
</div>



<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>w</th>
      <th>t</th>
      <th>R2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>y = f(x) = wlog(x) + t</th>
      <td>33.872055</td>
      <td>-211.663841</td>
      <td>0.13487</td>
    </tr>
  </tbody>
</table>
</div>


できたッ！