<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### _Problem 7.1: Practice writing posteriors (25 points + 10 points extra credit)_\n",
    "\n",
    "This problem is a worth a total of 25 points. You can do any subset of these problems to get full (or full plus extra) credit.\n",
    "\n",
    "### Part A (10 points) \n",
    "\n",
    "Write and/or draw a flow chart the details the steps from \"Write Bayes' Theorem\" to arriving at the final form of the posterior. Be as detailed as possible.\n",
    "\n",
    "### Part B (5 points ea.)\n",
    "\n",
    "The Elowitz lab is interested in the design principles of signaling pathway architecture, or how the interactions between signaling pathway components (things like extracellular ligands and receptors) give rise to different signal processing capabilities. Below are some experiments we might run to get a better quantitative understanding of cell signaling. \n",
    "\n",
    "For each of the following scenarios:\n",
    "* (3 pts) Write the full form of the posterior you would use to estimate the parameter(s). **You must define all symbols (e.g. parameters and variables) for full credit.**\n",
    "* (2 pts) Explain why you chose that form of the posterior, including what you chose to neglect or exclude. More than one version of the posterior may be appropriate, so give convincing reasons to select the form you wrote.\n",
    "\n",
    "#### Exercise 1: \n",
    "You have images of many fields of cells, where fluorescently-labeled receptors at the cell surface appear as dots. (Assume these are maximum projections of confocal images, so that the image includes the entire cell membrane). You would like to estimate the mean number of receptors expressed by this cell line, and are using an automated image analysis tool that can count the number of dots on each cell. A previous paper reported that there are are $10^6 \\pm 10^3$ of this receptor type expressed by this cell line.\n",
    "\n",
    "#### Exercise 2:\n",
    "You decide to get higher throughput counts by flowing your fluorescently-labeled cells. However, first you need to know how the fluorescence depends on the number of fluorophores, which we presume to be equal to the number of receptors. To start approximating this, you measure the fluorescence of beads ($F$) with a known number of fluorophores attached ($N$). You assume the fluorescence depends linearly on the number of fluorophores, and that there is some background fluorescence: \n",
    "\n",
    "\\begin{align}\n",
    "\\\\ F(N \\mid a, b) = aN + b\n",
    "\\end{align}\n",
    "\n",
    "We are interested in estimating the values of $a$ and $b$, though we recognize the background fluorescence will probably be different in our cells.\n",
    "\n",
    "#### Exercise 3:\n",
    "A fully-formed signaling complex requires two receptor subunits, and sometimes these receptor come together spontaneously. You want to estimate the average rate at which this happens. You put one half of a fluorescent protein on one receptor subunit and the other half on the other receptor subunit. If the subunits spontaneously come together, you will observe a fluorescent dot. You use time-lapse microscopy to image these cells, and generate a list of the times between dots on single cells (e.g. you waited $t_1$, $t_2$, etc. seconds between seeing receptors spontaneously come together).\n",
    "\n",
    "#### Exercise 4\n",
    "You weren't able to do the experiment described in **Exercise 3**, but you read about it in a paper and request the data. They send you a table that reports the number of times receptor complexes spontaneously formed in ten minute intervals. As above, you still want to estimate the average rate at which this happens. You also have an estimate and error bar for this rate from a different paper.\n",
    "\n",
    "#### Exercise 5:\n",
    "You are studying a signaling pathway that, when the ligand binds the receptor, forms a multimeric protein complex at the intracellular side of the membrane. You assume that the rate of each protein joining this complex is roughly the same. You want to estimate the number of proteins in this complex, and the average rate at which they join. You employ a similar approach as in **Exercise 3**, using protein fusions that produce a fluorescent signal only when the complex is fully-formed. You use time-lapse microscopy to time how long it takes the complex to fully form after you add the ligand."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### _Problem 7.1 Solution_\n",
    "\n",
    "### Part A (10 points) \n",
    "\n",
    "Write and/or draw a flow chart the details the steps from \"Write Bayes' Theorem\" to arriving at the final form of the posterior. Be as detailed as possible.\n",
    "\n",
    "### Part B (5 points ea.)\n",
    "\n",
    "The Elowitz lab is interested in the design principles of signaling pathway architecture, or how the interactions between signaling pathway components (things like extracellular ligands and receptors) give rise to different signal processing capabilities. Below are some experiments we might run to get a better quantitative understanding of cell signaling. \n",
    "\n",
    "For each of the following scenarios:\n",
    "* (3 pts) Write the full form of the posterior you would use to estimate the parameter(s). **You must define all symbols (e.g. parameters and variables) for full credit.**\n",
    "* (2 pts) Explain why you chose that form of the posterior, including what you chose to neglect or exclude. More than one version of the posterior may be appropriate, so give convincing reasons to select the form you wrote.\n",
    "\n",
    "_Note on these solutions:_\n",
    "\n",
    "For all my solutions, I neglect the evidence. As it's not a function of the parameter values, we can find the parameter values that maximize the posterior without knowing its value. Also, all my solutions will have the following format:\n",
    "\n",
    "\\begin{align}\n",
    "\\\\ \\mathrm{posterior} \\propto \\left( \\mathrm{likelihood} \\right) \\left( \\mathrm{prior} \\right) \n",
    "\\end{align}\n",
    "\n",
    "Note too that none of priors are properly normalized, and there are no bounds on the prior (i.e. I don't specify that it should be zero outside the allowed parameter range). If you're unsure how that changes the functional form of the posterior, you can see the flow chart I drew for **Part A** to see how that would be done.\n",
    "\n",
    "#### Exercise 1: \n",
    "You have images of many fields of cells, where fluorescently-labeled receptors at the cell surface appear as dots. (Assume these are maximum projections of confocal images, so that the image includes the entire cell membrane). You would like to estimate the mean number of receptors expressed by this cell line, and are using an automated image analysis tool that can count the number of dots on each cell. A previous paper reported that there are are $10^6 \\pm 10^3$ of this receptor type expressed by this cell line.\n",
    "\n",
    "_Functional form_: \n",
    "\n",
    "\\begin{align}\n",<commit_msg>Added an image link for Part A solution<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### _Problem 7.1: Practice writing posteriors (25 points + 10 points extra credit)_\n",
    "\n",
    "This problem is a worth a total of 25 points. You can do any subset of these problems to get full (or full plus extra) credit.\n",
    "\n",
    "### Part A (10 points) \n",
    "\n",
    "Write and/or draw a flow chart the details the steps from \"Write Bayes' Theorem\" to arriving at the final form of the posterior. Be as detailed as possible.\n",
    "\n",
    "### Part B (5 points ea.)\n",
    "\n",
    "The Elowitz lab is interested in the design principles of signaling pathway architecture, or how the interactions between signaling pathway components (things like extracellular ligands and receptors) give rise to different signal processing capabilities. Below are some experiments we might run to get a better quantitative understanding of cell signaling. \n",
    "\n",
    "For each of the following scenarios:\n",
    "* (3 pts) Write the full form of the posterior you would use to estimate the parameter(s). **You must define all symbols (e.g. parameters and variables) for full credit.**\n",
    "* (2 pts) Explain why you chose that form of the posterior, including what you chose to neglect or exclude. More than one version of the posterior may be appropriate, so give convincing reasons to select the form you wrote.\n",
    "\n",
    "#### Exercise 1: \n",
    "You have images of many fields of cells, where fluorescently-labeled receptors at the cell surface appear as dots. (Assume these are maximum projections of confocal images, so that the image includes the entire cell membrane). You would like to estimate the mean number of receptors expressed by this cell line, and are using an automated image analysis tool that can count the number of dots on each cell. A previous paper reported that there are are $10^6 \\pm 10^3$ of this receptor type expressed by this cell line.\n",
    "\n",
    "#### Exercise 2:\n",
    "You decide to get higher throughput counts by flowing your fluorescently-labeled cells. However, first you need to know how the fluorescence depends on the number of fluorophores, which we presume to be equal to the number of receptors. To start approximating this, you measure the fluorescence of beads ($F$) with a known number of fluorophores attached ($N$). You assume the fluorescence depends linearly on the number of fluorophores, and that there is some background fluorescence: \n",
    "\n",
    "\\begin{align}\n",
    "\\\\ F(N \\mid a, b) = aN + b\n",
    "\\end{align}\n",
    "\n",
    "We are interested in estimating the values of $a$ and $b$, though we recognize the background fluorescence will probably be different in our cells.\n",
    "\n",
    "#### Exercise 3:\n",
    "A fully-formed signaling complex requires two receptor subunits, and sometimes these receptor come together spontaneously. You want to estimate the average rate at which this happens. You put one half of a fluorescent protein on one receptor subunit and the other half on the other receptor subunit. If the subunits spontaneously come together, you will observe a fluorescent dot. You use time-lapse microscopy to image these cells, and generate a list of the times between dots on single cells (e.g. you waited $t_1$, $t_2$, etc. seconds between seeing receptors spontaneously come together).\n",
    "\n",
    "#### Exercise 4\n",
    "You weren't able to do the experiment described in **Exercise 3**, but you read about it in a paper and request the data. They send you a table that reports the number of times receptor complexes spontaneously formed in ten minute intervals. As above, you still want to estimate the average rate at which this happens. You also have an estimate and error bar for this rate from a different paper.\n",
    "\n",
    "#### Exercise 5:\n",
    "You are studying a signaling pathway that, when the ligand binds the receptor, forms a multimeric protein complex at the intracellular side of the membrane. You assume that the rate of each protein joining this complex is roughly the same. You want to estimate the number of proteins in this complex, and the average rate at which they join. You employ a similar approach as in **Exercise 3**, using protein fusions that produce a fluorescent signal only when the complex is fully-formed. You use time-lapse microscopy to time how long it takes the complex to fully form after you add the ligand."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### _Problem 7.1 Solution_\n",
    "\n",
    "### Part A (10 points) \n",
    "\n",
    "Write and/or draw a flow chart the details the steps from \"Write Bayes' Theorem\" to arriving at the final form of the posterior. Be as detailed as possible.\n",
    "\n",
    "_Sample Solution:_\n",
    "\n",
    "![Part A Solution](prob7.1a_solution.svg)\n",
    "\n",
    "### Part B (5 points ea.)\n",
    "\n",
    "The Elowitz lab is interested in the design principles of signaling pathway architecture, or how the interactions between signaling pathway components (things like extracellular ligands and receptors) give rise to different signal processing capabilities. Below are some experiments we might run to get a better quantitative understanding of cell signaling. \n",
    "\n",
    "For each of the following scenarios:\n",
    "* (3 pts) Write the full form of the posterior you would use to estimate the parameter(s). **You must define all symbols (e.g. parameters and variables) for full credit.**\n",
    "* (2 pts) Explain why you chose that form of the posterior, including what you chose to neglect or exclude. More than one version of the posterior may be appropriate, so give convincing reasons to select the form you wrote.\n",
    "\n",
    "_Note on these solutions:_\n",
    "\n",
    "For all my solutions, I neglect the evidence. As it's not a function of the parameter values, we can find the parameter values that maximize the posterior without knowing its value. Also, all my solutions will have the following format:\n",
    "\n",
    "\\begin{align}\n",
    "\\\\ \\mathrm{posterior} \\propto \\left( \\mathrm{likelihood} \\right) \\left( \\mathrm{prior} \\right) \n",
    "\\end{align}\n",
    "\n",
    "Note too that none of priors are properly normalized, and there are no bounds on the prior (i.e. I don't specify that it should be zero outside the allowed parameter range). If you're unsure how that changes the functional form of the posterior, you can see the flow chart I drew for **Part A** to see how that would be done.\n",
    "\n",
    "#### Exercise 1: \n",
    "You have images of many fields of cells, where fluorescently-labeled receptors at the cell surface appear as dots. (Assume these are maximum projections of confocal images, so that the image includes the entire cell membrane). You would like to estimate the mean number of receptors expressed by this cell line, and are using an automated image analysis tool that can count the number of dots on each cell. A previous paper reported that there are are $10^6 \\pm 10^3$ of this receptor type expressed by this cell line.\n",
    "\n",
    "_Functional form_: \n",
    "\n",
    "\\begin{align}\n",
{'fraction_non_alphanumeric': 0.08841902931283037, 'fraction_numerical': 0.005903755062813208, 'mean_word_length': 3.5510777881911904, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7303752', 'n_tokens_mistral': 3924, 'n_tokens_neox': 3566, 'n_words': 2177}