{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "777e2f25",
   "metadata": {},
   "source": [
    "## Exercise 15.3: WAIS\n",
    "\n",
    "First load the packages:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "63851c97",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import statsmodels.api as sm\n",
    "import statsmodels.formula.api as smf"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd62c23b",
   "metadata": {},
   "source": [
    "Referring to exercise 15.3 in Agresti, one of the WAIS subtests called *picture completion*, asks questions about 20 pictures that have one vital detail missing. It is considered a test of attention to fine detail.\n",
    "\n",
    "The observations for 20 subjects on (x,y), where x=picture completion score(0-20) and y=symptoms of senility(1=yes):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "88fe9395",
   "metadata": {},
   "outputs": [],
   "source": [
    "pictSen = pd.read_csv(\"https://asta.math.aau.dk/datasets?file=pictSen.csv\", sep='\\s+')\n",
    "pictSen"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "965de1ba",
   "metadata": {},
   "source": [
    "- Assume a simple logistic model and estimate the logistic regression equation.\n",
    "- Why is there a significant effect of picture completion on symptoms? \n",
    "- Estimate the probability that symptoms are present when (i) x=0, (ii) x=20.\n",
    "- Over what range of x-scores is the estimated probability of senility greater than 50%?\n",
    "- Estimate the effect of a one-unit increase in picture completion on the odds of\n",
    "  senility symptoms.\n",
    "- Provide a 95% confidence interval of this effect."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
