Skip to content

Commit

Permalink
deploy: d1969e1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Aug 13, 2024
1 parent d2ea6fa commit 8790b8d
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions assignments/_freeze/template2/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"hash": "173d81742d4df7d565e6d1285d77e421",
"hash": "6249c7033127855a0c3af37cb329b0d7",
"result": {
"engine": "knitr",
"markdown": "---\ntitle: \"Assignment 2\"\nauthor: anonymous # <-- hand in anonymously\nformat:\n html:\n toc: true\n code-tools: true\n code-line-numbers: true\n number-sections: true\n mainfont: Georgia, serif\n pdf:\n geometry:\n - left=1cm,top=1cm,bottom=1cm,right=7cm\n number-sections: true\n code-annotations: none\n include-in-header:\n text: |\n % You can add TeX macros here for PDF,\n % see https://quarto.org/docs/output-formats/pdf-basics.html#latex-includes\n \\newcommand{\\BetaDist}{\\mathrm{Beta}}\neditor: source\n---\n\n\n\n\n\n\n\n::: {.hidden}\n$$\n% You can add TeX macros here for HTML, see https://quarto.org/docs/authoring/markdown-basics.html#equations\n\\renewcommand{\\BetaDist}{\\mathrm{Beta}}\n$$\n:::\n\n# General information\n\n:::: {.content-hidden when-format=\"pdf\"}\n::: {.callout-warning collapse=false}\n\n## Setup\n\n\n*This block will only be visible in your HTML output, but will be hidden when rendering to PDF with quarto for the submission.*\n**Make sure that this does not get displayed in the PDF!**\n\n\n\n\nThis is the template for [assignment 2](assignment2.html). You can download the [qmd-file](https://avehtari.github.io/BDA_course_Aalto/assignments/template2.qmd) or copy the code from this rendered document after clicking on `</> Code` in the top right corner.\n\n**Please replace the instructions in this template by your own text, explaining what you are doing in each exercise.**\n\nThe following will set-up `markmyassignment` to check your functions at the end of the notebook:\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(markmyassignment)\nassignment_path = paste(\"https://github.com/avehtari/BDA_course_Aalto/\",\n\"blob/master/assignments/tests/assignment2.yml\", sep=\"\")\nset_assignment(assignment_path)\n```\n:::\n\n\n\n\n\n\nThe following installs the `aaltobda` package:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Caching should be fine here\ninstall.packages(\"aaltobda\", repos = c(\"https://avehtari.github.io/BDA_course_Aalto/\", getOption(\"repos\")))\n```\n:::\n\n\n\n\n\n\n:::\n::::\n\n\n# Inference for binomial proportion\n\nLoading the library and the data.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(aaltobda)\ndata(\"algae\")\n# The data are now stored in the variable `algae`.\n# These are the values for the prior required in the assignment\nprior_alpha = 2\nprior_beta = 10\n```\n:::\n\n\n\n\n\n\nThe below data is **only for the tests**, you need to change to the\nfull data `algae` when reporting your results.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nalgae_test <- c(0, 1, 1, 0, 0, 0)\n```\n:::\n\n\n\n\n\n\n\n\n## (a)\n\n\nWrite the likelihood, the prior and the posterior here!\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# These are not the actual values for the posterior!\n# You will have to compute those from the data!\nposterior_alpha = 2\nposterior_beta = 10\n```\n:::\n\n\n\n\n\n\nYou can do [string interpolation](https://en.wikipedia.org/wiki/String_interpolation) using [R inline code execution in quarto](https://quarto.org/docs/computations/execution-options.html#knitr) as such:\n\n$\\alpha_\\text{prior}$ is **2** and $\\beta_\\text{prior}$ is **10**.\nOr string interpolation within math: $\\BetaDist(2,10)$\n\nThis template defines a `\\BetaDist` TeX command which renders `$\\BetaDist(1,2)$` as $\\BetaDist(1,2)$.\n\n\n\n## (b)\n\n\nKeep the below name and format for the functions to work with `markmyassignment`:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: qbeta()\n\nbeta_point_est <- function(prior_alpha, prior_beta, data) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the prior provided above.\n 0.2222222\n}\nbeta_interval <- function(prior_alpha, prior_beta, data, prob=0.9) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the prior provided above.\n c(0.0846451, 0.3956414)\n}\n```\n:::\n\n\n\n\n\n\n\n\n## (c)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: pbeta()\n\nbeta_low <- function(prior_alpha, prior_beta, data, pi_0=0.2) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the correct prior.\n 0.4511238\n}\n```\n:::\n\n\n\n\n\n\n\n\n## (d)\n\n\nWrite your answer here!\n\n\n\n## (e)\n\n\nPlot the PDFs here. Explain shortly what you do.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: dbeta()\n```\n:::\n\n\n\n\n\n\n\n\n:::: {.content-hidden when-format=\"pdf\"}\n::: {.callout-warning collapse=false}\n\n## markmyassignment\n\n\n*This block will only be visible in your HTML output, but will be hidden when rendering to PDF with quarto for the submission.*\n**Make sure that this does not get displayed in the PDF!**\n\n\n\nThe following will check the functions for which `markmyassignment` has been set up:\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmark_my_assignment()\n```\n:::\n\n\n\n\n\n\n:::\n::::\n",
"markdown": "---\ntitle: \"Assignment 2\"\nauthor: anonymous # <-- hand in anonymously\nformat:\n html:\n toc: true\n code-tools: true\n code-line-numbers: true\n number-sections: true\n mainfont: Georgia, serif\n pdf:\n geometry:\n - left=1cm,top=1cm,bottom=1cm,right=7cm\n number-sections: true\n code-annotations: none\n include-in-header:\n text: |\n % You can add TeX macros here for PDF,\n % see https://quarto.org/docs/output-formats/pdf-basics.html#latex-includes\n \\newcommand{\\BetaDist}{\\mathrm{Beta}}\neditor: source\n---\n\n\n\n\n\n\n\n::: {.hidden}\n$$\n% You can add TeX macros here for HTML, see https://quarto.org/docs/authoring/markdown-basics.html#equations\n\\renewcommand{\\BetaDist}{\\mathrm{Beta}}\n$$\n:::\n\n# General information\n\n:::: {.content-hidden when-format=\"pdf\"}\n::: {.callout-warning collapse=false}\n\n## Setup\n\n\n*This block will only be visible in your HTML output, but will be hidden when rendering to PDF with quarto for the submission.*\n**Make sure that this does not get displayed in the PDF!**\n\n\n\n\nThis is the template for [assignment 2](assignment2.html). You can download the [qmd-file](https://avehtari.github.io/BDA_course_Aalto/assignments/template2.qmd) or copy the code from this rendered document after clicking on `</> Code` in the top right corner.\n\n**Please replace the instructions in this template by your own text, explaining what you are doing in each exercise.**\n\nThe following will set-up `markmyassignment` to check your functions at the end of the notebook:\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(markmyassignment)\nassignment_path = paste(\"https://github.com/avehtari/BDA_course_Aalto/\",\n\"blob/master/assignments/tests/assignment2.yml\", sep=\"\")\nset_assignment(assignment_path)\n```\n:::\n\n\n\n\n\n\nThe following installs the `aaltobda` package:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Caching should be fine here\ninstall.packages(\"aaltobda\", repos = c(\"https://avehtari.github.io/BDA_course_Aalto/\", getOption(\"repos\")))\n```\n:::\n\n\n\n\n\n\n:::\n::::\n\n\n# Inference for binomial proportion\n\nLoading the library and the data.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(aaltobda)\ndata(\"algae\")\n# The data are now stored in the variable `algae`.\n# These are the values for the prior required in the assignment\nprior_alpha = 2\nprior_beta = 10\n```\n:::\n\n\n\n\n\n\nThe below data is **only for the tests**, you need to change to the\nfull data `algae` when reporting your results.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nalgae_test <- c(0, 1, 1, 0, 0, 0)\n```\n:::\n\n\n\n\n\n\n\n\n## (a)\n\n\nWrite the likelihood, the prior and the posterior here!\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# These are not the actual values for the posterior!\n# You will have to compute those from the data!\nposterior_alpha = 2\nposterior_beta = 10\n```\n:::\n\n\n\n\n\n\nYou can do [string interpolation](https://en.wikipedia.org/wiki/String_interpolation) using [R inline code execution in quarto](https://quarto.org/docs/computations/execution-options.html#knitr) as such:\n\n$\\alpha_\\text{prior}$ is **10** and $\\beta_\\text{prior}$ is **2**.\nOr string interpolation within math: $\\BetaDist(10,2)$\n\nThis template defines a `\\BetaDist` TeX command which renders `$\\BetaDist(1,2)$` as $\\BetaDist(1,2)$.\n\n\n\n## (b)\n\n\nKeep the below name and format for the functions to work with `markmyassignment`:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: qbeta()\n\nbeta_point_est <- function(prior_alpha, prior_beta, data) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the prior provided above.\n 0.2222222\n}\nbeta_interval <- function(prior_alpha, prior_beta, data, prob=0.9) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the prior provided above.\n c(0.0846451, 0.3956414)\n}\n```\n:::\n\n\n\n\n\n\n\n\n## (c)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: pbeta()\n\nbeta_low <- function(prior_alpha, prior_beta, data, pi_0=0.2) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above,\n # combined with the correct prior.\n 0.4511238\n}\n```\n:::\n\n\n\n\n\n\n\n\n## (d)\n\n\nWrite your answer here!\n\n\n\n## (e)\n\n\nPlot the PDFs here. Explain shortly what you do.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful function: dbeta()\n```\n:::\n\n\n\n\n\n\n\n\n:::: {.content-hidden when-format=\"pdf\"}\n::: {.callout-warning collapse=false}\n\n## markmyassignment\n\n\n*This block will only be visible in your HTML output, but will be hidden when rendering to PDF with quarto for the submission.*\n**Make sure that this does not get displayed in the PDF!**\n\n\n\nThe following will check the functions for which `markmyassignment` has been set up:\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmark_my_assignment()\n```\n:::\n\n\n\n\n\n\n:::\n::::\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
Expand Down
Loading

0 comments on commit 8790b8d

Please sign in to comment.