### Importing packages

#### Others


```python
# Used to read the data file
import pandas as pd

# Used in the definition of the model and its initial condition
import numpy as np

# Used for plots other than those generated by the parameter estimation module
import matplotlib.pyplot as plt
%matplotlib inline
```

#### The module itself


```python
import PDEparams as pde
```

### Defining the model

We use a classic two-species predator-prey model:

$$\begin{align}
\frac{\mathrm{d} x}{\mathrm{d} t} &= a\, x(1-x)-b\,x\,y\\
\frac{\mathrm{d} y}{\mathrm{d} t} &= b\,x\,y-y
\end{align}$$

Note that the arguments below do not include a spatial grid, since we are dealing with ODEs.


```python
def LotkaVolterra(z, t, a, b):
    '''The input z corresponds to the current state of the system, z = [x, y]. Since the input is in 1D, no 
    pre-processing is needed.
    
    t is the current time.
    
    a and b correspond to the unknown parameters.
    '''
    
    x, y = z
    
    return [a*x*(1-x)-b*x*y, b*x*y-y]
```

Here we specify the functions that define the initial condition for each variable. Since there is no spatial dependence, the initial functions don't take any arguments and return a constant value. The initial condition used for data generation corresponds to $(x,y)=(0.3,0.5)$


```python
def initial_x():
    return 0.3

def initial_y():
    return 0.5
```

### Using `PDEparams` to estimate parameters

First, we load the data from the `.csv` file.

The data consist of 3 replicates, and have been generated using parameter values $a=3$, $b=1$.

The columns are, in order: $t$, $x$, $y$.


```python
df = pd.read_csv('LotkaVolterraData.csv')

df.head()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>0.060606</td>
      <td>0.325940</td>
      <td>0.469672</td>
    </tr>
    <tr>
      <th>1</th>
      <td>0.060606</td>
      <td>0.326474</td>
      <td>0.475169</td>
    </tr>
    <tr>
      <th>2</th>
      <td>0.060606</td>
      <td>0.317529</td>
      <td>0.486987</td>
    </tr>
    <tr>
      <th>3</th>
      <td>0.070707</td>
      <td>0.340549</td>
      <td>0.492719</td>
    </tr>
    <tr>
      <th>4</th>
      <td>0.070707</td>
      <td>0.324513</td>
      <td>0.470383</td>
    </tr>
  </tbody>
</table>
</div>



#### Constructing the `PDEmodel` object.

The inputs are

**Required:**
1. The data table `df`.
2. The model `LotkaVolterra`.
3. The list of initial condition functions.
4. The bounds for the parameter values.

**Optional:**
1. The parameter names.
2. The number of variables: 2. **(Default is 1, this needs to be provided in this case)**
3. The number of spatial dimensions: 0. **(Default is 1, this needs to be provided in this case)**
4. The number of replicates in the data: 3. **(Default is 1, this needs to be provided in this case)**
5. The indices of the measured variables. In this case, the default `None`, since we have data for all 2 variables.
6. The function to apply to the output. In this case, the default `None`, since our data is directly $x$ and $y$.


```python
my_model = pde.PDEmodel(df, LotkaVolterra, [initial_x, initial_y], bounds=[(2, 4), (0.5,2)], 
                        param_names=[r'$a$', r'$b$'], nvars=2, ndims=0, nreplicates=3, obsidx=None, outfunc=None)
```


```python
# Printing the initial condition
my_model.initial_condition
```




    array([0.3, 0.5])



#### Finding the best fit parameters.


```python
%%time
my_model.fit()
```

            $a$       $b$
    0  2.993904  1.001379
    CPU times: user 279 ms, sys: 1.73 ms, total: 280 ms
    Wall time: 290 ms



```python
my_model.best_params
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2.993904</td>
      <td>1.001379</td>
    </tr>
  </tbody>
</table>
</div>




```python
my_model.best_error
```




    9.413324634610873e-05



#### Likelihood profiles

We use the default grid of 100 points per parameter.

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below. 


```python
%%time
my_model.likelihood_profiles()
```


    HBox(children=(IntProgress(value=0, description='parameters', max=2, style=ProgressStyle(description_width='in…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…


    
    CPU times: user 32.8 s, sys: 114 ms, total: 33 s
    Wall time: 36.3 s


The raw results


```python
my_model.result_profiles
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>parameter</th>
      <th>value</th>
      <th>error</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>$a$</td>
      <td>2.000000</td>
      <td>0.003617</td>
    </tr>
    <tr>
      <th>1</th>
      <td>$a$</td>
      <td>2.020202</td>
      <td>0.003437</td>
    </tr>
    <tr>
      <th>2</th>
      <td>$a$</td>
      <td>2.040404</td>
      <td>0.003264</td>
    </tr>
    <tr>
      <th>3</th>
      <td>$a$</td>
      <td>2.060606</td>
      <td>0.003099</td>
    </tr>
    <tr>
      <th>4</th>
      <td>$a$</td>
      <td>2.080808</td>
      <td>0.002942</td>
    </tr>
    <tr>
      <th>5</th>
      <td>$a$</td>
      <td>2.101010</td>
      <td>0.002792</td>
    </tr>
    <tr>
      <th>6</th>
      <td>$a$</td>
      <td>2.121212</td>
      <td>0.002649</td>
    </tr>
    <tr>
      <th>7</th>
      <td>$a$</td>
      <td>2.141414</td>
      <td>0.002513</td>
    </tr>
    <tr>
      <th>8</th>
      <td>$a$</td>
      <td>2.161616</td>
      <td>0.002385</td>
    </tr>
    <tr>
      <th>9</th>
      <td>$a$</td>
      <td>2.181818</td>
      <td>0.002263</td>
    </tr>
    <tr>
      <th>10</th>
      <td>$a$</td>
      <td>2.202020</td>
      <td>0.002149</td>
    </tr>
    <tr>
      <th>11</th>
      <td>$a$</td>
      <td>2.222222</td>
      <td>0.002041</td>
    </tr>
    <tr>
      <th>12</th>
      <td>$a$</td>
      <td>2.242424</td>
      <td>0.001940</td>
    </tr>
    <tr>
      <th>13</th>
      <td>$a$</td>
      <td>2.262626</td>
      <td>0.001841</td>
    </tr>
    <tr>
      <th>14</th>
      <td>$a$</td>
      <td>2.282828</td>
      <td>0.001746</td>
    </tr>
    <tr>
      <th>15</th>
      <td>$a$</td>
      <td>2.303030</td>
      <td>0.001653</td>
    </tr>
    <tr>
      <th>16</th>
      <td>$a$</td>
      <td>2.323232</td>
      <td>0.001562</td>
    </tr>
    <tr>
      <th>17</th>
      <td>$a$</td>
      <td>2.343434</td>
      <td>0.001475</td>
    </tr>
    <tr>
      <th>18</th>
      <td>$a$</td>
      <td>2.363636</td>
      <td>0.001390</td>
    </tr>
    <tr>
      <th>19</th>
      <td>$a$</td>
      <td>2.383838</td>
      <td>0.001308</td>
    </tr>
    <tr>
      <th>20</th>
      <td>$a$</td>
      <td>2.404040</td>
      <td>0.001228</td>
    </tr>
    <tr>
      <th>21</th>
      <td>$a$</td>
      <td>2.424242</td>
      <td>0.001151</td>
    </tr>
    <tr>
      <th>22</th>
      <td>$a$</td>
      <td>2.444444</td>
      <td>0.001077</td>
    </tr>
    <tr>
      <th>23</th>
      <td>$a$</td>
      <td>2.464646</td>
      <td>0.001006</td>
    </tr>
    <tr>
      <th>24</th>
      <td>$a$</td>
      <td>2.484848</td>
      <td>0.000937</td>
    </tr>
    <tr>
      <th>25</th>
      <td>$a$</td>
      <td>2.505051</td>
      <td>0.000871</td>
    </tr>
    <tr>
      <th>26</th>
      <td>$a$</td>
      <td>2.525253</td>
      <td>0.000807</td>
    </tr>
    <tr>
      <th>27</th>
      <td>$a$</td>
      <td>2.545455</td>
      <td>0.000747</td>
    </tr>
    <tr>
      <th>28</th>
      <td>$a$</td>
      <td>2.565657</td>
      <td>0.000689</td>
    </tr>
    <tr>
      <th>29</th>
      <td>$a$</td>
      <td>2.585859</td>
      <td>0.000634</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>170</th>
      <td>$b$</td>
      <td>1.560606</td>
      <td>0.002154</td>
    </tr>
    <tr>
      <th>171</th>
      <td>$b$</td>
      <td>1.575758</td>
      <td>0.002278</td>
    </tr>
    <tr>
      <th>172</th>
      <td>$b$</td>
      <td>1.590909</td>
      <td>0.002405</td>
    </tr>
    <tr>
      <th>173</th>
      <td>$b$</td>
      <td>1.606061</td>
      <td>0.002537</td>
    </tr>
    <tr>
      <th>174</th>
      <td>$b$</td>
      <td>1.621212</td>
      <td>0.002673</td>
    </tr>
    <tr>
      <th>175</th>
      <td>$b$</td>
      <td>1.636364</td>
      <td>0.002813</td>
    </tr>
    <tr>
      <th>176</th>
      <td>$b$</td>
      <td>1.651515</td>
      <td>0.002957</td>
    </tr>
    <tr>
      <th>177</th>
      <td>$b$</td>
      <td>1.666667</td>
      <td>0.003105</td>
    </tr>
    <tr>
      <th>178</th>
      <td>$b$</td>
      <td>1.681818</td>
      <td>0.003258</td>
    </tr>
    <tr>
      <th>179</th>
      <td>$b$</td>
      <td>1.696970</td>
      <td>0.003415</td>
    </tr>
    <tr>
      <th>180</th>
      <td>$b$</td>
      <td>1.712121</td>
      <td>0.003577</td>
    </tr>
    <tr>
      <th>181</th>
      <td>$b$</td>
      <td>1.727273</td>
      <td>0.003742</td>
    </tr>
    <tr>
      <th>182</th>
      <td>$b$</td>
      <td>1.742424</td>
      <td>0.003912</td>
    </tr>
    <tr>
      <th>183</th>
      <td>$b$</td>
      <td>1.757576</td>
      <td>0.004087</td>
    </tr>
    <tr>
      <th>184</th>
      <td>$b$</td>
      <td>1.772727</td>
      <td>0.004266</td>
    </tr>
    <tr>
      <th>185</th>
      <td>$b$</td>
      <td>1.787879</td>
      <td>0.004449</td>
    </tr>
    <tr>
      <th>186</th>
      <td>$b$</td>
      <td>1.803030</td>
      <td>0.004636</td>
    </tr>
    <tr>
      <th>187</th>
      <td>$b$</td>
      <td>1.818182</td>
      <td>0.004829</td>
    </tr>
    <tr>
      <th>188</th>
      <td>$b$</td>
      <td>1.833333</td>
      <td>0.005025</td>
    </tr>
    <tr>
      <th>189</th>
      <td>$b$</td>
      <td>1.848485</td>
      <td>0.005226</td>
    </tr>
    <tr>
      <th>190</th>
      <td>$b$</td>
      <td>1.863636</td>
      <td>0.005432</td>
    </tr>
    <tr>
      <th>191</th>
      <td>$b$</td>
      <td>1.878788</td>
      <td>0.005642</td>
    </tr>
    <tr>
      <th>192</th>
      <td>$b$</td>
      <td>1.893939</td>
      <td>0.005856</td>
    </tr>
    <tr>
      <th>193</th>
      <td>$b$</td>
      <td>1.909091</td>
      <td>0.006075</td>
    </tr>
    <tr>
      <th>194</th>
      <td>$b$</td>
      <td>1.924242</td>
      <td>0.006299</td>
    </tr>
    <tr>
      <th>195</th>
      <td>$b$</td>
      <td>1.939394</td>
      <td>0.006527</td>
    </tr>
    <tr>
      <th>196</th>
      <td>$b$</td>
      <td>1.954545</td>
      <td>0.006759</td>
    </tr>
    <tr>
      <th>197</th>
      <td>$b$</td>
      <td>1.969697</td>
      <td>0.006996</td>
    </tr>
    <tr>
      <th>198</th>
      <td>$b$</td>
      <td>1.984848</td>
      <td>0.007238</td>
    </tr>
    <tr>
      <th>199</th>
      <td>$b$</td>
      <td>2.000000</td>
      <td>0.007484</td>
    </tr>
  </tbody>
</table>
<p>200 rows × 3 columns</p>
</div>



Visualisation


```python
my_model.plot_profiles()
```

#### Bootstrapping

We use the default 100 repetitions.

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below.


```python
%%time
my_model.bootstrap()
```


    HBox(children=(IntProgress(value=0, description='runs', style=ProgressStyle(description_width='initial')), HTM…


    
                  $a$         $b$
    count  100.000000  100.000000
    mean     2.990633    0.999784
    std      0.010713    0.007454
    min      2.965644    0.982297
    25%      2.983347    0.995204
    50%      2.990437    0.999729
    75%      2.997088    1.003723
    max      3.025524    1.020776
    CPU times: user 26.9 s, sys: 46.2 ms, total: 27 s
    Wall time: 30 s


The summary


```python
my_model.bootstrap_summary
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>count</th>
      <td>100.000000</td>
      <td>100.000000</td>
    </tr>
    <tr>
      <th>mean</th>
      <td>2.990633</td>
      <td>0.999784</td>
    </tr>
    <tr>
      <th>std</th>
      <td>0.010713</td>
      <td>0.007454</td>
    </tr>
    <tr>
      <th>min</th>
      <td>2.965644</td>
      <td>0.982297</td>
    </tr>
    <tr>
      <th>25%</th>
      <td>2.983347</td>
      <td>0.995204</td>
    </tr>
    <tr>
      <th>50%</th>
      <td>2.990437</td>
      <td>0.999729</td>
    </tr>
    <tr>
      <th>75%</th>
      <td>2.997088</td>
      <td>1.003723</td>
    </tr>
    <tr>
      <th>max</th>
      <td>3.025524</td>
      <td>1.020776</td>
    </tr>
  </tbody>
</table>
</div>



The raw results


```python
my_model.bootstrap_raw
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3.003469</td>
      <td>1.018804</td>
    </tr>
    <tr>
      <th>1</th>
      <td>3.001168</td>
      <td>1.010144</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2.987095</td>
      <td>0.992268</td>
    </tr>
    <tr>
      <th>3</th>
      <td>2.984709</td>
      <td>1.002661</td>
    </tr>
    <tr>
      <th>4</th>
      <td>2.978693</td>
      <td>0.997317</td>
    </tr>
    <tr>
      <th>5</th>
      <td>2.985765</td>
      <td>0.986396</td>
    </tr>
    <tr>
      <th>6</th>
      <td>2.987959</td>
      <td>1.001987</td>
    </tr>
    <tr>
      <th>7</th>
      <td>2.993803</td>
      <td>1.008941</td>
    </tr>
    <tr>
      <th>8</th>
      <td>2.999806</td>
      <td>0.995116</td>
    </tr>
    <tr>
      <th>9</th>
      <td>2.991132</td>
      <td>0.988603</td>
    </tr>
    <tr>
      <th>10</th>
      <td>2.996658</td>
      <td>1.003443</td>
    </tr>
    <tr>
      <th>11</th>
      <td>2.988690</td>
      <td>0.997330</td>
    </tr>
    <tr>
      <th>12</th>
      <td>3.006180</td>
      <td>1.008987</td>
    </tr>
    <tr>
      <th>13</th>
      <td>3.010555</td>
      <td>1.007097</td>
    </tr>
    <tr>
      <th>14</th>
      <td>2.996630</td>
      <td>0.999482</td>
    </tr>
    <tr>
      <th>15</th>
      <td>2.998953</td>
      <td>1.001399</td>
    </tr>
    <tr>
      <th>16</th>
      <td>2.988674</td>
      <td>1.000994</td>
    </tr>
    <tr>
      <th>17</th>
      <td>2.988828</td>
      <td>0.994609</td>
    </tr>
    <tr>
      <th>18</th>
      <td>2.991506</td>
      <td>1.002362</td>
    </tr>
    <tr>
      <th>19</th>
      <td>2.991680</td>
      <td>1.003272</td>
    </tr>
    <tr>
      <th>20</th>
      <td>2.981228</td>
      <td>0.997796</td>
    </tr>
    <tr>
      <th>21</th>
      <td>2.988050</td>
      <td>1.005017</td>
    </tr>
    <tr>
      <th>22</th>
      <td>2.974612</td>
      <td>0.991993</td>
    </tr>
    <tr>
      <th>23</th>
      <td>2.981773</td>
      <td>0.997162</td>
    </tr>
    <tr>
      <th>24</th>
      <td>3.003005</td>
      <td>1.006047</td>
    </tr>
    <tr>
      <th>25</th>
      <td>2.993998</td>
      <td>1.004142</td>
    </tr>
    <tr>
      <th>26</th>
      <td>3.002892</td>
      <td>1.001237</td>
    </tr>
    <tr>
      <th>27</th>
      <td>2.978464</td>
      <td>1.000084</td>
    </tr>
    <tr>
      <th>28</th>
      <td>2.983403</td>
      <td>1.006757</td>
    </tr>
    <tr>
      <th>29</th>
      <td>2.996396</td>
      <td>1.013988</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>70</th>
      <td>2.974032</td>
      <td>0.995756</td>
    </tr>
    <tr>
      <th>71</th>
      <td>2.991096</td>
      <td>0.999210</td>
    </tr>
    <tr>
      <th>72</th>
      <td>2.983527</td>
      <td>1.002550</td>
    </tr>
    <tr>
      <th>73</th>
      <td>3.002846</td>
      <td>1.017781</td>
    </tr>
    <tr>
      <th>74</th>
      <td>2.985241</td>
      <td>1.001709</td>
    </tr>
    <tr>
      <th>75</th>
      <td>2.996998</td>
      <td>1.001349</td>
    </tr>
    <tr>
      <th>76</th>
      <td>2.991980</td>
      <td>0.986823</td>
    </tr>
    <tr>
      <th>77</th>
      <td>2.994040</td>
      <td>1.005094</td>
    </tr>
    <tr>
      <th>78</th>
      <td>2.988161</td>
      <td>1.006140</td>
    </tr>
    <tr>
      <th>79</th>
      <td>3.011394</td>
      <td>1.012344</td>
    </tr>
    <tr>
      <th>80</th>
      <td>2.965644</td>
      <td>0.982297</td>
    </tr>
    <tr>
      <th>81</th>
      <td>3.007071</td>
      <td>0.998107</td>
    </tr>
    <tr>
      <th>82</th>
      <td>2.992535</td>
      <td>0.996828</td>
    </tr>
    <tr>
      <th>83</th>
      <td>2.994667</td>
      <td>1.000332</td>
    </tr>
    <tr>
      <th>84</th>
      <td>3.002469</td>
      <td>1.002912</td>
    </tr>
    <tr>
      <th>85</th>
      <td>3.000906</td>
      <td>1.004076</td>
    </tr>
    <tr>
      <th>86</th>
      <td>2.976200</td>
      <td>0.985227</td>
    </tr>
    <tr>
      <th>87</th>
      <td>3.001998</td>
      <td>0.998558</td>
    </tr>
    <tr>
      <th>88</th>
      <td>2.983179</td>
      <td>0.998220</td>
    </tr>
    <tr>
      <th>89</th>
      <td>2.983757</td>
      <td>0.993848</td>
    </tr>
    <tr>
      <th>90</th>
      <td>2.984062</td>
      <td>0.996825</td>
    </tr>
    <tr>
      <th>91</th>
      <td>2.995231</td>
      <td>1.009268</td>
    </tr>
    <tr>
      <th>92</th>
      <td>2.982378</td>
      <td>0.995767</td>
    </tr>
    <tr>
      <th>93</th>
      <td>2.984077</td>
      <td>0.992630</td>
    </tr>
    <tr>
      <th>94</th>
      <td>2.992840</td>
      <td>0.995233</td>
    </tr>
    <tr>
      <th>95</th>
      <td>2.992151</td>
      <td>1.003035</td>
    </tr>
    <tr>
      <th>96</th>
      <td>3.000065</td>
      <td>1.003652</td>
    </tr>
    <tr>
      <th>97</th>
      <td>2.986510</td>
      <td>0.997617</td>
    </tr>
    <tr>
      <th>98</th>
      <td>2.977861</td>
      <td>0.997611</td>
    </tr>
    <tr>
      <th>99</th>
      <td>2.988477</td>
      <td>0.995422</td>
    </tr>
  </tbody>
</table>
<p>100 rows × 2 columns</p>
</div>



Visualisation


```python
my_model.plot_bootstrap()
```

### Only one observed variable

Let us suppose now that we only have data for $y$.


```python
df2 = df[df.columns[[0,2]]] # x, which we are ignoring, is column 1 in the data table

df2.head()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>0.060606</td>
      <td>0.469672</td>
    </tr>
    <tr>
      <th>1</th>
      <td>0.060606</td>
      <td>0.475169</td>
    </tr>
    <tr>
      <th>2</th>
      <td>0.060606</td>
      <td>0.486987</td>
    </tr>
    <tr>
      <th>3</th>
      <td>0.070707</td>
      <td>0.492719</td>
    </tr>
    <tr>
      <th>4</th>
      <td>0.070707</td>
      <td>0.470383</td>
    </tr>
  </tbody>
</table>
</div>



#### Constructing the `PDEmodel` object.

The inputs are the same as before, except for the data&mdash;now `df2` instead of `df`&mdash;and `obsidx`, which specifies that we only have data for the 2nd variable in the system. Starting from zero, the corresponding index is 1. Since we only have one observed variable, `obsidx` can be either a number or a list of one element.


```python
my_model2 = pde.PDEmodel(df2, LotkaVolterra, [initial_x, initial_y], bounds=[(2, 4), (0.5,2)], 
                         param_names=[r'$a$', r'$b$'], nvars=2, ndims=0, nreplicates=3, obsidx=[1], outfunc=None)
```

#### Finding the best fit parameters.


```python
%%time
my_model2.fit()
```

           $a$       $b$
    0  2.83873  1.029909
    CPU times: user 176 ms, sys: 25 µs, total: 176 ms
    Wall time: 179 ms



```python
my_model2.best_params
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2.83873</td>
      <td>1.029909</td>
    </tr>
  </tbody>
</table>
</div>




```python
my_model2.best_error
```




    9.187040918800129e-05



#### Likelihood profiles

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below.


```python
%%time
my_model2.likelihood_profiles()
```


    HBox(children=(IntProgress(value=0, description='parameters', max=2, style=ProgressStyle(description_width='in…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…


    
    CPU times: user 43.7 s, sys: 104 ms, total: 43.8 s
    Wall time: 49.7 s


The raw results


```python
my_model2.result_profiles
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>parameter</th>
      <th>value</th>
      <th>error</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>$a$</td>
      <td>2.000000</td>
      <td>0.000102</td>
    </tr>
    <tr>
      <th>1</th>
      <td>$a$</td>
      <td>2.020202</td>
      <td>0.000101</td>
    </tr>
    <tr>
      <th>2</th>
      <td>$a$</td>
      <td>2.040404</td>
      <td>0.000101</td>
    </tr>
    <tr>
      <th>3</th>
      <td>$a$</td>
      <td>2.060606</td>
      <td>0.000100</td>
    </tr>
    <tr>
      <th>4</th>
      <td>$a$</td>
      <td>2.080808</td>
      <td>0.000100</td>
    </tr>
    <tr>
      <th>5</th>
      <td>$a$</td>
      <td>2.101010</td>
      <td>0.000099</td>
    </tr>
    <tr>
      <th>6</th>
      <td>$a$</td>
      <td>2.121212</td>
      <td>0.000099</td>
    </tr>
    <tr>
      <th>7</th>
      <td>$a$</td>
      <td>2.141414</td>
      <td>0.000098</td>
    </tr>
    <tr>
      <th>8</th>
      <td>$a$</td>
      <td>2.161616</td>
      <td>0.000098</td>
    </tr>
    <tr>
      <th>9</th>
      <td>$a$</td>
      <td>2.181818</td>
      <td>0.000097</td>
    </tr>
    <tr>
      <th>10</th>
      <td>$a$</td>
      <td>2.202020</td>
      <td>0.000097</td>
    </tr>
    <tr>
      <th>11</th>
      <td>$a$</td>
      <td>2.222222</td>
      <td>0.000096</td>
    </tr>
    <tr>
      <th>12</th>
      <td>$a$</td>
      <td>2.242424</td>
      <td>0.000096</td>
    </tr>
    <tr>
      <th>13</th>
      <td>$a$</td>
      <td>2.262626</td>
      <td>0.000096</td>
    </tr>
    <tr>
      <th>14</th>
      <td>$a$</td>
      <td>2.282828</td>
      <td>0.000095</td>
    </tr>
    <tr>
      <th>15</th>
      <td>$a$</td>
      <td>2.303030</td>
      <td>0.000095</td>
    </tr>
    <tr>
      <th>16</th>
      <td>$a$</td>
      <td>2.323232</td>
      <td>0.000095</td>
    </tr>
    <tr>
      <th>17</th>
      <td>$a$</td>
      <td>2.343434</td>
      <td>0.000095</td>
    </tr>
    <tr>
      <th>18</th>
      <td>$a$</td>
      <td>2.363636</td>
      <td>0.000094</td>
    </tr>
    <tr>
      <th>19</th>
      <td>$a$</td>
      <td>2.383838</td>
      <td>0.000094</td>
    </tr>
    <tr>
      <th>20</th>
      <td>$a$</td>
      <td>2.404040</td>
      <td>0.000094</td>
    </tr>
    <tr>
      <th>21</th>
      <td>$a$</td>
      <td>2.424242</td>
      <td>0.000094</td>
    </tr>
    <tr>
      <th>22</th>
      <td>$a$</td>
      <td>2.444444</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>23</th>
      <td>$a$</td>
      <td>2.464646</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>24</th>
      <td>$a$</td>
      <td>2.484848</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>25</th>
      <td>$a$</td>
      <td>2.505051</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>26</th>
      <td>$a$</td>
      <td>2.525253</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>27</th>
      <td>$a$</td>
      <td>2.545455</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>28</th>
      <td>$a$</td>
      <td>2.565657</td>
      <td>0.000093</td>
    </tr>
    <tr>
      <th>29</th>
      <td>$a$</td>
      <td>2.585859</td>
      <td>0.000092</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>170</th>
      <td>$b$</td>
      <td>1.560606</td>
      <td>0.000553</td>
    </tr>
    <tr>
      <th>171</th>
      <td>$b$</td>
      <td>1.575758</td>
      <td>0.000594</td>
    </tr>
    <tr>
      <th>172</th>
      <td>$b$</td>
      <td>1.590909</td>
      <td>0.000637</td>
    </tr>
    <tr>
      <th>173</th>
      <td>$b$</td>
      <td>1.606061</td>
      <td>0.000681</td>
    </tr>
    <tr>
      <th>174</th>
      <td>$b$</td>
      <td>1.621212</td>
      <td>0.000727</td>
    </tr>
    <tr>
      <th>175</th>
      <td>$b$</td>
      <td>1.636364</td>
      <td>0.000775</td>
    </tr>
    <tr>
      <th>176</th>
      <td>$b$</td>
      <td>1.651515</td>
      <td>0.000824</td>
    </tr>
    <tr>
      <th>177</th>
      <td>$b$</td>
      <td>1.666667</td>
      <td>0.000875</td>
    </tr>
    <tr>
      <th>178</th>
      <td>$b$</td>
      <td>1.681818</td>
      <td>0.000927</td>
    </tr>
    <tr>
      <th>179</th>
      <td>$b$</td>
      <td>1.696970</td>
      <td>0.000981</td>
    </tr>
    <tr>
      <th>180</th>
      <td>$b$</td>
      <td>1.712121</td>
      <td>0.001037</td>
    </tr>
    <tr>
      <th>181</th>
      <td>$b$</td>
      <td>1.727273</td>
      <td>0.001094</td>
    </tr>
    <tr>
      <th>182</th>
      <td>$b$</td>
      <td>1.742424</td>
      <td>0.001152</td>
    </tr>
    <tr>
      <th>183</th>
      <td>$b$</td>
      <td>1.757576</td>
      <td>0.001212</td>
    </tr>
    <tr>
      <th>184</th>
      <td>$b$</td>
      <td>1.772727</td>
      <td>0.001273</td>
    </tr>
    <tr>
      <th>185</th>
      <td>$b$</td>
      <td>1.787879</td>
      <td>0.001336</td>
    </tr>
    <tr>
      <th>186</th>
      <td>$b$</td>
      <td>1.803030</td>
      <td>0.001400</td>
    </tr>
    <tr>
      <th>187</th>
      <td>$b$</td>
      <td>1.818182</td>
      <td>0.001465</td>
    </tr>
    <tr>
      <th>188</th>
      <td>$b$</td>
      <td>1.833333</td>
      <td>0.001532</td>
    </tr>
    <tr>
      <th>189</th>
      <td>$b$</td>
      <td>1.848485</td>
      <td>0.001600</td>
    </tr>
    <tr>
      <th>190</th>
      <td>$b$</td>
      <td>1.863636</td>
      <td>0.001669</td>
    </tr>
    <tr>
      <th>191</th>
      <td>$b$</td>
      <td>1.878788</td>
      <td>0.001740</td>
    </tr>
    <tr>
      <th>192</th>
      <td>$b$</td>
      <td>1.893939</td>
      <td>0.001812</td>
    </tr>
    <tr>
      <th>193</th>
      <td>$b$</td>
      <td>1.909091</td>
      <td>0.001885</td>
    </tr>
    <tr>
      <th>194</th>
      <td>$b$</td>
      <td>1.924242</td>
      <td>0.001959</td>
    </tr>
    <tr>
      <th>195</th>
      <td>$b$</td>
      <td>1.939394</td>
      <td>0.002035</td>
    </tr>
    <tr>
      <th>196</th>
      <td>$b$</td>
      <td>1.954545</td>
      <td>0.002112</td>
    </tr>
    <tr>
      <th>197</th>
      <td>$b$</td>
      <td>1.969697</td>
      <td>0.002190</td>
    </tr>
    <tr>
      <th>198</th>
      <td>$b$</td>
      <td>1.984848</td>
      <td>0.002269</td>
    </tr>
    <tr>
      <th>199</th>
      <td>$b$</td>
      <td>2.000000</td>
      <td>0.002349</td>
    </tr>
  </tbody>
</table>
<p>200 rows × 3 columns</p>
</div>



Visualisation


```python
my_model2.plot_profiles()
```

#### Bootstrapping

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below.


```python
%%time
my_model2.bootstrap()
```


    HBox(children=(IntProgress(value=0, description='runs', style=ProgressStyle(description_width='initial')), HTM…


    
                  $a$         $b$
    count  100.000000  100.000000
    mean     2.928028    1.017756
    std      0.401623    0.070162
    min      2.151616    0.851199
    25%      2.641515    0.968889
    50%      2.817236    1.029071
    75%      3.133648    1.065381
    max      3.994846    1.196032
    CPU times: user 22.4 s, sys: 118 ms, total: 22.5 s
    Wall time: 25.2 s


The summary


```python
my_model2.bootstrap_summary
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>count</th>
      <td>100.000000</td>
      <td>100.000000</td>
    </tr>
    <tr>
      <th>mean</th>
      <td>2.928028</td>
      <td>1.017756</td>
    </tr>
    <tr>
      <th>std</th>
      <td>0.401623</td>
      <td>0.070162</td>
    </tr>
    <tr>
      <th>min</th>
      <td>2.151616</td>
      <td>0.851199</td>
    </tr>
    <tr>
      <th>25%</th>
      <td>2.641515</td>
      <td>0.968889</td>
    </tr>
    <tr>
      <th>50%</th>
      <td>2.817236</td>
      <td>1.029071</td>
    </tr>
    <tr>
      <th>75%</th>
      <td>3.133648</td>
      <td>1.065381</td>
    </tr>
    <tr>
      <th>max</th>
      <td>3.994846</td>
      <td>1.196032</td>
    </tr>
  </tbody>
</table>
</div>



The raw results


```python
my_model2.bootstrap_raw
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3.186450</td>
      <td>0.966881</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2.994018</td>
      <td>0.992822</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2.229250</td>
      <td>1.172231</td>
    </tr>
    <tr>
      <th>3</th>
      <td>2.736436</td>
      <td>1.045355</td>
    </tr>
    <tr>
      <th>4</th>
      <td>3.459128</td>
      <td>0.931309</td>
    </tr>
    <tr>
      <th>5</th>
      <td>2.771381</td>
      <td>1.040382</td>
    </tr>
    <tr>
      <th>6</th>
      <td>2.934312</td>
      <td>1.002232</td>
    </tr>
    <tr>
      <th>7</th>
      <td>2.734665</td>
      <td>1.056124</td>
    </tr>
    <tr>
      <th>8</th>
      <td>3.028957</td>
      <td>0.992229</td>
    </tr>
    <tr>
      <th>9</th>
      <td>2.466829</td>
      <td>1.098155</td>
    </tr>
    <tr>
      <th>10</th>
      <td>3.021764</td>
      <td>0.978904</td>
    </tr>
    <tr>
      <th>11</th>
      <td>2.605139</td>
      <td>1.077158</td>
    </tr>
    <tr>
      <th>12</th>
      <td>2.829591</td>
      <td>1.028945</td>
    </tr>
    <tr>
      <th>13</th>
      <td>2.829072</td>
      <td>1.036971</td>
    </tr>
    <tr>
      <th>14</th>
      <td>2.786716</td>
      <td>1.024529</td>
    </tr>
    <tr>
      <th>15</th>
      <td>2.410657</td>
      <td>1.125444</td>
    </tr>
    <tr>
      <th>16</th>
      <td>2.703599</td>
      <td>1.060549</td>
    </tr>
    <tr>
      <th>17</th>
      <td>2.887153</td>
      <td>1.011713</td>
    </tr>
    <tr>
      <th>18</th>
      <td>2.487482</td>
      <td>1.092487</td>
    </tr>
    <tr>
      <th>19</th>
      <td>2.551906</td>
      <td>1.073295</td>
    </tr>
    <tr>
      <th>20</th>
      <td>3.351057</td>
      <td>0.950278</td>
    </tr>
    <tr>
      <th>21</th>
      <td>3.196387</td>
      <td>0.963497</td>
    </tr>
    <tr>
      <th>22</th>
      <td>3.185130</td>
      <td>0.963274</td>
    </tr>
    <tr>
      <th>23</th>
      <td>3.989835</td>
      <td>0.860150</td>
    </tr>
    <tr>
      <th>24</th>
      <td>3.264633</td>
      <td>0.953557</td>
    </tr>
    <tr>
      <th>25</th>
      <td>2.269456</td>
      <td>1.175272</td>
    </tr>
    <tr>
      <th>26</th>
      <td>2.629859</td>
      <td>1.069511</td>
    </tr>
    <tr>
      <th>27</th>
      <td>2.619347</td>
      <td>1.070337</td>
    </tr>
    <tr>
      <th>28</th>
      <td>3.017502</td>
      <td>0.995884</td>
    </tr>
    <tr>
      <th>29</th>
      <td>2.633942</td>
      <td>1.060323</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>70</th>
      <td>2.617034</td>
      <td>1.085760</td>
    </tr>
    <tr>
      <th>71</th>
      <td>2.513154</td>
      <td>1.086689</td>
    </tr>
    <tr>
      <th>72</th>
      <td>2.631748</td>
      <td>1.058986</td>
    </tr>
    <tr>
      <th>73</th>
      <td>2.473401</td>
      <td>1.110266</td>
    </tr>
    <tr>
      <th>74</th>
      <td>3.120630</td>
      <td>0.969463</td>
    </tr>
    <tr>
      <th>75</th>
      <td>3.085647</td>
      <td>0.967169</td>
    </tr>
    <tr>
      <th>76</th>
      <td>2.662882</td>
      <td>1.066937</td>
    </tr>
    <tr>
      <th>77</th>
      <td>2.660752</td>
      <td>1.054912</td>
    </tr>
    <tr>
      <th>78</th>
      <td>3.309790</td>
      <td>0.961033</td>
    </tr>
    <tr>
      <th>79</th>
      <td>3.911726</td>
      <td>0.873615</td>
    </tr>
    <tr>
      <th>80</th>
      <td>2.542773</td>
      <td>1.091506</td>
    </tr>
    <tr>
      <th>81</th>
      <td>2.151616</td>
      <td>1.196032</td>
    </tr>
    <tr>
      <th>82</th>
      <td>2.512438</td>
      <td>1.103099</td>
    </tr>
    <tr>
      <th>83</th>
      <td>2.879644</td>
      <td>1.023525</td>
    </tr>
    <tr>
      <th>84</th>
      <td>3.143682</td>
      <td>0.962638</td>
    </tr>
    <tr>
      <th>85</th>
      <td>2.503046</td>
      <td>1.110733</td>
    </tr>
    <tr>
      <th>86</th>
      <td>3.265422</td>
      <td>0.951855</td>
    </tr>
    <tr>
      <th>87</th>
      <td>3.529360</td>
      <td>0.915736</td>
    </tr>
    <tr>
      <th>88</th>
      <td>2.782934</td>
      <td>1.044810</td>
    </tr>
    <tr>
      <th>89</th>
      <td>2.946202</td>
      <td>1.009231</td>
    </tr>
    <tr>
      <th>90</th>
      <td>2.536247</td>
      <td>1.101490</td>
    </tr>
    <tr>
      <th>91</th>
      <td>3.074829</td>
      <td>0.979491</td>
    </tr>
    <tr>
      <th>92</th>
      <td>3.985203</td>
      <td>0.870064</td>
    </tr>
    <tr>
      <th>93</th>
      <td>3.135816</td>
      <td>0.976863</td>
    </tr>
    <tr>
      <th>94</th>
      <td>2.553888</td>
      <td>1.080913</td>
    </tr>
    <tr>
      <th>95</th>
      <td>2.823732</td>
      <td>1.032444</td>
    </tr>
    <tr>
      <th>96</th>
      <td>3.671526</td>
      <td>0.906530</td>
    </tr>
    <tr>
      <th>97</th>
      <td>2.674485</td>
      <td>1.060072</td>
    </tr>
    <tr>
      <th>98</th>
      <td>3.931037</td>
      <td>0.859171</td>
    </tr>
    <tr>
      <th>99</th>
      <td>2.771113</td>
      <td>1.050614</td>
    </tr>
  </tbody>
</table>
<p>100 rows × 2 columns</p>
</div>



Visualisation


```python
my_model2.plot_bootstrap()
```

### Only a function of the variables is observed

Finally, we consider the case when it's not the raw outputs of the system that are observed, but rather a function of them. In this case, let us assume that the observed quantity is

$$\mathcal{F}(x, y) = x\,y$$


```python
df3 = df[df.columns[[0]]] # we take only the time-points

# We add the new function
df3[r'$\mathcal{F}$'] = df['1']*df['2'] # x and y are, respectively, columns 1 and 2 in the data table

df3.head()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>$\mathcal{F}$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>0.060606</td>
      <td>0.153085</td>
    </tr>
    <tr>
      <th>1</th>
      <td>0.060606</td>
      <td>0.155130</td>
    </tr>
    <tr>
      <th>2</th>
      <td>0.060606</td>
      <td>0.154632</td>
    </tr>
    <tr>
      <th>3</th>
      <td>0.070707</td>
      <td>0.167795</td>
    </tr>
    <tr>
      <th>4</th>
      <td>0.070707</td>
      <td>0.152645</td>
    </tr>
  </tbody>
</table>
</div>



#### Constructing the `PDEmodel` object.

The inputs are the same as before, except for the data&mdash;now `df3`&mdash;and `outfunc`, which specifies the function to be applied to the outputs before computing the error.


```python
def F(z):
    x, y = z
    
    return x*y
```


```python
my_model3 = pde.PDEmodel(df3, LotkaVolterra, [initial_x, initial_y], bounds=[(2, 4), (0.5,2)], 
                         param_names=[r'$a$', r'$b$'], nvars=2, ndims=0, nreplicates=3, obsidx=None, outfunc=F)
```

#### Finding the best fit parameters.


```python
%%time
my_model3.fit()
```

            $a$       $b$
    0  3.013358  0.962529
    CPU times: user 1.16 s, sys: 4.47 ms, total: 1.16 s
    Wall time: 1.47 s



```python
my_model3.best_params
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3.013358</td>
      <td>0.962529</td>
    </tr>
  </tbody>
</table>
</div>




```python
my_model3.best_error
```




    4.443543597892799e-05



#### Likelihood profiles

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below.


```python
%%time
my_model3.likelihood_profiles()
```


    HBox(children=(IntProgress(value=0, description='parameters', max=2, style=ProgressStyle(description_width='in…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…



    HBox(children=(IntProgress(value=0, description='values within parameters', style=ProgressStyle(description_wi…


    
    CPU times: user 2min 5s, sys: 234 ms, total: 2min 5s
    Wall time: 2min 24s


The raw results


```python
my_model3.result_profiles
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>parameter</th>
      <th>value</th>
      <th>error</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>$a$</td>
      <td>2.000000</td>
      <td>0.002442</td>
    </tr>
    <tr>
      <th>1</th>
      <td>$a$</td>
      <td>2.020202</td>
      <td>0.002340</td>
    </tr>
    <tr>
      <th>2</th>
      <td>$a$</td>
      <td>2.040404</td>
      <td>0.002239</td>
    </tr>
    <tr>
      <th>3</th>
      <td>$a$</td>
      <td>2.060606</td>
      <td>0.002140</td>
    </tr>
    <tr>
      <th>4</th>
      <td>$a$</td>
      <td>2.080808</td>
      <td>0.002043</td>
    </tr>
    <tr>
      <th>5</th>
      <td>$a$</td>
      <td>2.101010</td>
      <td>0.001948</td>
    </tr>
    <tr>
      <th>6</th>
      <td>$a$</td>
      <td>2.121212</td>
      <td>0.001854</td>
    </tr>
    <tr>
      <th>7</th>
      <td>$a$</td>
      <td>2.141414</td>
      <td>0.001763</td>
    </tr>
    <tr>
      <th>8</th>
      <td>$a$</td>
      <td>2.161616</td>
      <td>0.001674</td>
    </tr>
    <tr>
      <th>9</th>
      <td>$a$</td>
      <td>2.181818</td>
      <td>0.001587</td>
    </tr>
    <tr>
      <th>10</th>
      <td>$a$</td>
      <td>2.202020</td>
      <td>0.001503</td>
    </tr>
    <tr>
      <th>11</th>
      <td>$a$</td>
      <td>2.222222</td>
      <td>0.001420</td>
    </tr>
    <tr>
      <th>12</th>
      <td>$a$</td>
      <td>2.242424</td>
      <td>0.001340</td>
    </tr>
    <tr>
      <th>13</th>
      <td>$a$</td>
      <td>2.262626</td>
      <td>0.001261</td>
    </tr>
    <tr>
      <th>14</th>
      <td>$a$</td>
      <td>2.282828</td>
      <td>0.001185</td>
    </tr>
    <tr>
      <th>15</th>
      <td>$a$</td>
      <td>2.303030</td>
      <td>0.001112</td>
    </tr>
    <tr>
      <th>16</th>
      <td>$a$</td>
      <td>2.323232</td>
      <td>0.001040</td>
    </tr>
    <tr>
      <th>17</th>
      <td>$a$</td>
      <td>2.343434</td>
      <td>0.000971</td>
    </tr>
    <tr>
      <th>18</th>
      <td>$a$</td>
      <td>2.363636</td>
      <td>0.000904</td>
    </tr>
    <tr>
      <th>19</th>
      <td>$a$</td>
      <td>2.383838</td>
      <td>0.000840</td>
    </tr>
    <tr>
      <th>20</th>
      <td>$a$</td>
      <td>2.404040</td>
      <td>0.000778</td>
    </tr>
    <tr>
      <th>21</th>
      <td>$a$</td>
      <td>2.424242</td>
      <td>0.000719</td>
    </tr>
    <tr>
      <th>22</th>
      <td>$a$</td>
      <td>2.444444</td>
      <td>0.000662</td>
    </tr>
    <tr>
      <th>23</th>
      <td>$a$</td>
      <td>2.464646</td>
      <td>0.000608</td>
    </tr>
    <tr>
      <th>24</th>
      <td>$a$</td>
      <td>2.484848</td>
      <td>0.000556</td>
    </tr>
    <tr>
      <th>25</th>
      <td>$a$</td>
      <td>2.505051</td>
      <td>0.000507</td>
    </tr>
    <tr>
      <th>26</th>
      <td>$a$</td>
      <td>2.525253</td>
      <td>0.000460</td>
    </tr>
    <tr>
      <th>27</th>
      <td>$a$</td>
      <td>2.545455</td>
      <td>0.000416</td>
    </tr>
    <tr>
      <th>28</th>
      <td>$a$</td>
      <td>2.565657</td>
      <td>0.000375</td>
    </tr>
    <tr>
      <th>29</th>
      <td>$a$</td>
      <td>2.585859</td>
      <td>0.000336</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>170</th>
      <td>$b$</td>
      <td>1.560606</td>
      <td>0.000092</td>
    </tr>
    <tr>
      <th>171</th>
      <td>$b$</td>
      <td>1.575758</td>
      <td>0.000094</td>
    </tr>
    <tr>
      <th>172</th>
      <td>$b$</td>
      <td>1.590909</td>
      <td>0.000095</td>
    </tr>
    <tr>
      <th>173</th>
      <td>$b$</td>
      <td>1.606061</td>
      <td>0.000096</td>
    </tr>
    <tr>
      <th>174</th>
      <td>$b$</td>
      <td>1.621212</td>
      <td>0.000098</td>
    </tr>
    <tr>
      <th>175</th>
      <td>$b$</td>
      <td>1.636364</td>
      <td>0.000099</td>
    </tr>
    <tr>
      <th>176</th>
      <td>$b$</td>
      <td>1.651515</td>
      <td>0.000100</td>
    </tr>
    <tr>
      <th>177</th>
      <td>$b$</td>
      <td>1.666667</td>
      <td>0.000102</td>
    </tr>
    <tr>
      <th>178</th>
      <td>$b$</td>
      <td>1.681818</td>
      <td>0.000103</td>
    </tr>
    <tr>
      <th>179</th>
      <td>$b$</td>
      <td>1.696970</td>
      <td>0.000104</td>
    </tr>
    <tr>
      <th>180</th>
      <td>$b$</td>
      <td>1.712121</td>
      <td>0.000106</td>
    </tr>
    <tr>
      <th>181</th>
      <td>$b$</td>
      <td>1.727273</td>
      <td>0.000107</td>
    </tr>
    <tr>
      <th>182</th>
      <td>$b$</td>
      <td>1.742424</td>
      <td>0.000108</td>
    </tr>
    <tr>
      <th>183</th>
      <td>$b$</td>
      <td>1.757576</td>
      <td>0.000109</td>
    </tr>
    <tr>
      <th>184</th>
      <td>$b$</td>
      <td>1.772727</td>
      <td>0.000110</td>
    </tr>
    <tr>
      <th>185</th>
      <td>$b$</td>
      <td>1.787879</td>
      <td>0.000111</td>
    </tr>
    <tr>
      <th>186</th>
      <td>$b$</td>
      <td>1.803030</td>
      <td>0.000112</td>
    </tr>
    <tr>
      <th>187</th>
      <td>$b$</td>
      <td>1.818182</td>
      <td>0.000113</td>
    </tr>
    <tr>
      <th>188</th>
      <td>$b$</td>
      <td>1.833333</td>
      <td>0.000114</td>
    </tr>
    <tr>
      <th>189</th>
      <td>$b$</td>
      <td>1.848485</td>
      <td>0.000115</td>
    </tr>
    <tr>
      <th>190</th>
      <td>$b$</td>
      <td>1.863636</td>
      <td>0.000116</td>
    </tr>
    <tr>
      <th>191</th>
      <td>$b$</td>
      <td>1.878788</td>
      <td>0.000117</td>
    </tr>
    <tr>
      <th>192</th>
      <td>$b$</td>
      <td>1.893939</td>
      <td>0.000118</td>
    </tr>
    <tr>
      <th>193</th>
      <td>$b$</td>
      <td>1.909091</td>
      <td>0.000119</td>
    </tr>
    <tr>
      <th>194</th>
      <td>$b$</td>
      <td>1.924242</td>
      <td>0.000120</td>
    </tr>
    <tr>
      <th>195</th>
      <td>$b$</td>
      <td>1.939394</td>
      <td>0.000121</td>
    </tr>
    <tr>
      <th>196</th>
      <td>$b$</td>
      <td>1.954545</td>
      <td>0.000121</td>
    </tr>
    <tr>
      <th>197</th>
      <td>$b$</td>
      <td>1.969697</td>
      <td>0.000122</td>
    </tr>
    <tr>
      <th>198</th>
      <td>$b$</td>
      <td>1.984848</td>
      <td>0.000123</td>
    </tr>
    <tr>
      <th>199</th>
      <td>$b$</td>
      <td>2.000000</td>
      <td>0.000123</td>
    </tr>
  </tbody>
</table>
<p>200 rows × 3 columns</p>
</div>



Visualisation


```python
my_model3.plot_profiles()
```

#### Bootstrapping

**Note:** if you see a "widget not found" message, just ignore it; a progress bar will appear when you run the cell below.


```python
%%time
my_model3.bootstrap()
```


    HBox(children=(IntProgress(value=0, description='runs', style=ProgressStyle(description_width='initial')), HTM…


    
                  $a$         $b$
    count  100.000000  100.000000
    mean     3.010285    0.965811
    std      0.019293    0.030561
    min      2.963211    0.892835
    25%      2.998660    0.946928
    50%      3.009469    0.967059
    75%      3.021914    0.985858
    max      3.060564    1.053666
    CPU times: user 46.2 s, sys: 71.1 ms, total: 46.3 s
    Wall time: 51.7 s


The summary


```python
my_model3.bootstrap_summary
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>count</th>
      <td>100.000000</td>
      <td>100.000000</td>
    </tr>
    <tr>
      <th>mean</th>
      <td>3.010285</td>
      <td>0.965811</td>
    </tr>
    <tr>
      <th>std</th>
      <td>0.019293</td>
      <td>0.030561</td>
    </tr>
    <tr>
      <th>min</th>
      <td>2.963211</td>
      <td>0.892835</td>
    </tr>
    <tr>
      <th>25%</th>
      <td>2.998660</td>
      <td>0.946928</td>
    </tr>
    <tr>
      <th>50%</th>
      <td>3.009469</td>
      <td>0.967059</td>
    </tr>
    <tr>
      <th>75%</th>
      <td>3.021914</td>
      <td>0.985858</td>
    </tr>
    <tr>
      <th>max</th>
      <td>3.060564</td>
      <td>1.053666</td>
    </tr>
  </tbody>
</table>
</div>



The raw results


```python
my_model3.bootstrap_raw
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>$a$</th>
      <th>$b$</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3.004544</td>
      <td>0.975553</td>
    </tr>
    <tr>
      <th>1</th>
      <td>3.011460</td>
      <td>0.944719</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3.022243</td>
      <td>0.956418</td>
    </tr>
    <tr>
      <th>3</th>
      <td>3.041521</td>
      <td>0.945383</td>
    </tr>
    <tr>
      <th>4</th>
      <td>3.033754</td>
      <td>0.943021</td>
    </tr>
    <tr>
      <th>5</th>
      <td>3.008854</td>
      <td>0.952098</td>
    </tr>
    <tr>
      <th>6</th>
      <td>3.004783</td>
      <td>0.966086</td>
    </tr>
    <tr>
      <th>7</th>
      <td>3.021300</td>
      <td>0.984676</td>
    </tr>
    <tr>
      <th>8</th>
      <td>2.993500</td>
      <td>0.981311</td>
    </tr>
    <tr>
      <th>9</th>
      <td>3.001813</td>
      <td>0.992382</td>
    </tr>
    <tr>
      <th>10</th>
      <td>3.026699</td>
      <td>0.948382</td>
    </tr>
    <tr>
      <th>11</th>
      <td>3.005744</td>
      <td>1.003509</td>
    </tr>
    <tr>
      <th>12</th>
      <td>3.019751</td>
      <td>0.951532</td>
    </tr>
    <tr>
      <th>13</th>
      <td>3.023140</td>
      <td>0.917367</td>
    </tr>
    <tr>
      <th>14</th>
      <td>2.992995</td>
      <td>1.005790</td>
    </tr>
    <tr>
      <th>15</th>
      <td>3.007374</td>
      <td>0.947082</td>
    </tr>
    <tr>
      <th>16</th>
      <td>3.017306</td>
      <td>0.943250</td>
    </tr>
    <tr>
      <th>17</th>
      <td>2.996537</td>
      <td>0.985509</td>
    </tr>
    <tr>
      <th>18</th>
      <td>2.993801</td>
      <td>0.976761</td>
    </tr>
    <tr>
      <th>19</th>
      <td>2.985710</td>
      <td>1.012736</td>
    </tr>
    <tr>
      <th>20</th>
      <td>3.007024</td>
      <td>0.983270</td>
    </tr>
    <tr>
      <th>21</th>
      <td>3.026094</td>
      <td>0.933456</td>
    </tr>
    <tr>
      <th>22</th>
      <td>2.998895</td>
      <td>0.997762</td>
    </tr>
    <tr>
      <th>23</th>
      <td>3.004754</td>
      <td>0.954400</td>
    </tr>
    <tr>
      <th>24</th>
      <td>2.994770</td>
      <td>0.949515</td>
    </tr>
    <tr>
      <th>25</th>
      <td>3.017222</td>
      <td>0.957733</td>
    </tr>
    <tr>
      <th>26</th>
      <td>3.009368</td>
      <td>0.949289</td>
    </tr>
    <tr>
      <th>27</th>
      <td>3.003725</td>
      <td>0.967571</td>
    </tr>
    <tr>
      <th>28</th>
      <td>3.001721</td>
      <td>1.000419</td>
    </tr>
    <tr>
      <th>29</th>
      <td>3.041532</td>
      <td>0.930961</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>70</th>
      <td>3.011897</td>
      <td>0.981077</td>
    </tr>
    <tr>
      <th>71</th>
      <td>3.046875</td>
      <td>0.897459</td>
    </tr>
    <tr>
      <th>72</th>
      <td>3.018500</td>
      <td>0.953763</td>
    </tr>
    <tr>
      <th>73</th>
      <td>2.974220</td>
      <td>1.053666</td>
    </tr>
    <tr>
      <th>74</th>
      <td>2.977706</td>
      <td>1.004024</td>
    </tr>
    <tr>
      <th>75</th>
      <td>2.997120</td>
      <td>0.951527</td>
    </tr>
    <tr>
      <th>76</th>
      <td>2.986780</td>
      <td>1.023515</td>
    </tr>
    <tr>
      <th>77</th>
      <td>3.028154</td>
      <td>0.968776</td>
    </tr>
    <tr>
      <th>78</th>
      <td>3.007104</td>
      <td>0.940048</td>
    </tr>
    <tr>
      <th>79</th>
      <td>3.038248</td>
      <td>0.926103</td>
    </tr>
    <tr>
      <th>80</th>
      <td>2.997953</td>
      <td>0.957914</td>
    </tr>
    <tr>
      <th>81</th>
      <td>3.002111</td>
      <td>0.971376</td>
    </tr>
    <tr>
      <th>82</th>
      <td>2.986691</td>
      <td>0.967823</td>
    </tr>
    <tr>
      <th>83</th>
      <td>3.019109</td>
      <td>0.946467</td>
    </tr>
    <tr>
      <th>84</th>
      <td>3.013573</td>
      <td>0.983129</td>
    </tr>
    <tr>
      <th>85</th>
      <td>3.023152</td>
      <td>0.966546</td>
    </tr>
    <tr>
      <th>86</th>
      <td>3.000544</td>
      <td>0.965003</td>
    </tr>
    <tr>
      <th>87</th>
      <td>3.020180</td>
      <td>0.948670</td>
    </tr>
    <tr>
      <th>88</th>
      <td>3.006561</td>
      <td>0.965161</td>
    </tr>
    <tr>
      <th>89</th>
      <td>3.031220</td>
      <td>0.940459</td>
    </tr>
    <tr>
      <th>90</th>
      <td>2.997364</td>
      <td>0.986108</td>
    </tr>
    <tr>
      <th>91</th>
      <td>3.009976</td>
      <td>0.991857</td>
    </tr>
    <tr>
      <th>92</th>
      <td>3.037319</td>
      <td>0.954682</td>
    </tr>
    <tr>
      <th>93</th>
      <td>3.016250</td>
      <td>0.948644</td>
    </tr>
    <tr>
      <th>94</th>
      <td>3.016100</td>
      <td>0.927069</td>
    </tr>
    <tr>
      <th>95</th>
      <td>3.011795</td>
      <td>0.952902</td>
    </tr>
    <tr>
      <th>96</th>
      <td>3.060564</td>
      <td>0.893783</td>
    </tr>
    <tr>
      <th>97</th>
      <td>3.052337</td>
      <td>0.907510</td>
    </tr>
    <tr>
      <th>98</th>
      <td>2.979961</td>
      <td>0.988719</td>
    </tr>
    <tr>
      <th>99</th>
      <td>2.981551</td>
      <td>0.985775</td>
    </tr>
  </tbody>
</table>
<p>100 rows × 2 columns</p>
</div>



Visualisation


```python
my_model3.plot_bootstrap()
```

0466b42a94e07cf0baad6b98f30afdc1afecde9f
ipynb
Jupyter Notebook
examples/LotkaVolterra.ipynb
systemsmedicine/PDEparams-1
8f7f4653b8cf9a06cf461cee132957a84ed92811
MIT
2019-12-20T05:03:46.000Z
2021-10-07T18:18:53.000Z
examples/LotkaVolterra.ipynb
systemsmedicine/PDEparams-1
8f7f4653b8cf9a06cf461cee132957a84ed92811
MIT
2021-09-02T11:54:31.000Z
2021-11-03T01:45:22.000Z
examples/LotkaVolterra.ipynb
systemsmedicine/PDEparams-1
8f7f4653b8cf9a06cf461cee132957a84ed92811
MIT
2019-12-20T05:04:26.000Z
2021-11-10T15:53:25.000Z
Qwen/Qwen-72B
1. YES
2. YES