{ "cells": [ { "cell_type": "markdown", "id": "258bdbae", "metadata": {}, "source": [ "# Estimation\n", "\n", "This page estimates the model parameters. We will do this in two steps:\n", "1. [Using a grid of parameters values](grid)\n", "2. [Using a Optimizer](opt)\n", "\n", "```{warning} \n", "Remember that `dhr.func` is the sintax that calls the file with the functions see before.\n", "```\n", "\n", "## Packages" ] }, { "cell_type": "code", "execution_count": 1, "id": "29f8d7e7", "metadata": {}, "outputs": [], "source": [ "import time\n", "import numpy as np\n", "import pandas as pd\n", "import seaborn as sns\n", "import dhr_functions as dhr\n", "from scipy.optimize import minimize\n", "from matplotlib import pyplot as plt" ] }, { "cell_type": "markdown", "id": "250052b5", "metadata": {}, "source": [ "## Calling the simulated data for the treatment\n", "\n", "First we will call our simulated data using the function and transform in a dictionary. The dictionary makes \n", "the estimation faster. The dataframe_simulation function creates two dataset (control and treatment) and put them \n", "in a dictionary to return. `dataset` is going to store this dictionary." ] }, { "cell_type": "code", "execution_count": 2, "id": "2ada1f50", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, { "data": { "text/html": [ "
\n", " | id | \n", "t | \n", "d+1 | \n", "d | \n", "L | \n", "eps | \n", "U | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "1 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "-0.572858 | \n", "50.736634 | \n", "
1 | \n", "0 | \n", "2 | \n", "2.0 | \n", "1.0 | \n", "0.0 | \n", "0.154607 | \n", "50.538425 | \n", "
2 | \n", "0 | \n", "3 | \n", "2.0 | \n", "2.0 | \n", "1.0 | \n", "1.889621 | \n", "51.730462 | \n", "
3 | \n", "0 | \n", "4 | \n", "3.0 | \n", "2.0 | \n", "0.0 | \n", "-0.613751 | \n", "48.642785 | \n", "
4 | \n", "0 | \n", "5 | \n", "4.0 | \n", "3.0 | \n", "0.0 | \n", "-0.192819 | \n", "48.444930 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2995 | \n", "99 | \n", "26 | \n", "18.0 | \n", "17.0 | \n", "0.0 | \n", "0.194402 | \n", "33.791186 | \n", "
2996 | \n", "99 | \n", "27 | \n", "19.0 | \n", "18.0 | \n", "0.0 | \n", "-1.103202 | \n", "33.593390 | \n", "
2997 | \n", "99 | \n", "28 | \n", "20.0 | \n", "19.0 | \n", "0.0 | \n", "-0.675562 | \n", "33.395593 | \n", "
2998 | \n", "99 | \n", "29 | \n", "21.0 | \n", "20.0 | \n", "0.0 | \n", "-1.585189 | \n", "33.197797 | \n", "
2999 | \n", "99 | \n", "30 | \n", "22.0 | \n", "21.0 | \n", "0.0 | \n", "0.482229 | \n", "1100.000000 | \n", "
3000 rows × 7 columns
\n", "