Created using Colaboratory
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"provenance": [],
|
||||
"authorship_tag": "ABX9TyPNAZtbS+8jYc+tZqhDHNev",
|
||||
"authorship_tag": "ABX9TyOPv/l+ToaApJV7Nz+8AtpV",
|
||||
"include_colab_link": true
|
||||
},
|
||||
"kernelspec": {
|
||||
@@ -401,12 +401,25 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# Now let's plot the likelihood, negative log likelihood as a function the value of the offset beta1\n",
|
||||
"fig, ax = plt.subplots(1,2)\n",
|
||||
"fig.set_size_inches(10.5, 3.5)\n",
|
||||
"fig.tight_layout(pad=3.0)\n",
|
||||
"ax[0].plot(beta_1_vals, likelihoods); ax[0].set_xlabel('beta_1[0,0]'); ax[0].set_ylabel('likelihood')\n",
|
||||
"ax[1].plot(beta_1_vals, nlls); ax[1].set_xlabel('beta_1[0,0]'); ax[1].set_ylabel('negative log likelihood')\n",
|
||||
"# Now let's plot the likelihood, negative log likelihood, and least squares as a function the value of the offset beta1\n",
|
||||
"fig, ax = plt.subplots()\n",
|
||||
"fig.tight_layout(pad=5.0)\n",
|
||||
"likelihood_color = 'tab:red'\n",
|
||||
"nll_color = 'tab:blue'\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"ax.set_xlabel('beta_1[0, 0]')\n",
|
||||
"ax.set_ylabel('likelihood', color = likelihood_color)\n",
|
||||
"ax.plot(beta_1_vals, likelihoods, color = likelihood_color)\n",
|
||||
"ax.tick_params(axis='y', labelcolor=likelihood_color)\n",
|
||||
"\n",
|
||||
"ax1 = ax.twinx()\n",
|
||||
"ax1.plot(beta_1_vals, nlls, color = nll_color)\n",
|
||||
"ax1.set_ylabel('negative log likelihood', color = nll_color)\n",
|
||||
"ax1.tick_params(axis='y', labelcolor = nll_color)\n",
|
||||
"\n",
|
||||
"plt.axvline(x = beta_1_vals[np.argmax(likelihoods)], linestyle='dotted')\n",
|
||||
"\n",
|
||||
"plt.show()"
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user