Skip to content

Commit

Permalink
deploy: f8eb27f
Browse files Browse the repository at this point in the history
  • Loading branch information
nsiccha committed Oct 27, 2023
1 parent cc40073 commit 99857dc
Show file tree
Hide file tree
Showing 48 changed files with 299 additions and 1,042 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion assignments/_freeze/template1/execute-results/html.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assignments/_freeze/template1/execute-results/tex.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"hash": "0ed9dcbcb2b9d3dd38dd58e0b8aa1a67",
"result": {
"markdown": "---\ntitle: \"Assignment 1\"\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\neditor: source\n---\n\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 1](assignment1.html). You can download the [qmd-file](https://avehtari.github.io/BDA_course_Aalto/assignments/template1.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::: {.cell}\n\n```{.r .cell-code}\nlibrary(markmyassignment)\nassignment_path = paste(\"https://github.com/avehtari/BDA_course_Aalto/\",\n\"blob/master/assignments/tests/assignment1.yml\", sep=\"\")\nset_assignment(assignment_path)\n```\n\n::: {.cell-output .cell-output-stderr}\n```\nAssignment set:\nassignment1: Bayesian Data Analysis: Assignment 1\nThe assignment contain the following (3) tasks:\n- p_red\n- p_box\n- p_identical_twin\n```\n:::\n:::\n\n\n\n:::\n::::\n\n\n# Basic probability theory notation and terms\n\nWrite your answers here!\n\n\n\n# Basic computer skills\n\nDo some setup here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Do some setup:\ndistribution_mean = .2\ndistribution_variance = .01\n\n# You have to compute the parameters below from the given mean and variance\n# distribution_alpha = ...\n# distribution_beta = ...\n```\n:::\n\n\n\n\n\n## (a)\n\n\nPlot the PDF here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: seq(), plot() and dbeta()\n```\n:::\n\n\n\n\n\n## (b)\n\n\nSample and plot the histogram here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: rbeta() and hist()\n```\n:::\n\n\n\n\n\n## (c)\n\n\nCompute the sample mean and variance here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: mean() and var()\n```\n:::\n\n\n\n\n\n## (d)\n\n\nCompute the central interval here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: quantile()\n```\n:::\n\n\n\n\n# Bayes' theorem 1\n\n## (a)\n\n\nCompute the quantities needed to justify your recommendation here. Explain in text what you do.\nYou can do the computation with pen and paper or in R.\nEither way, you have to explain why you compute what you compute.\n\nIf you use pen and paper, you can include scans or pictures as follows (see also [assignment_instructions#fig-workflow](assignment_instructions#fig-workflow)):\n\n![Parts of Bayesian workflow](additional_files/bayes_workflow.jpg){#fig-workflow width=\"350\"}\n\nSee @fig-workflow for illustration of parts of Bayesian workflow.\n\n\n# Bayes' theorem 2\n\nYou will need to change the numbers to the numbers in the exercise.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nboxes_test <- matrix(c(2,2,1,5,5,1), ncol = 2,\n dimnames = list(c(\"A\", \"B\", \"C\"), c(\"red\", \"white\")))\n```\n:::\n\n\n\n\n\n## (a)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_red <- function(boxes) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n 0.3928571\n}\n```\n:::\n\n\n\n\n\n## (b)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_box <- function(boxes) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n c(0.29090909,0.07272727,0.63636364)\n}\n```\n:::\n\n\n\n\n# Bayes' theorem 3\n\n## (a)\n\n\nYou will need to change the numbers to the numbers in the exercise.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nfraternal_prob = 1/125\nidentical_prob = 1/300\n```\n:::\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_identical_twin <- function(fraternal_prob, identical_prob) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n 0.4545455\n}\n```\n:::\n\n\n\n\n# The three steps of Bayesian data analysis\n\n## (a)\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::: {.cell}\n\n```{.r .cell-code}\nmark_my_assignment()\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nv | F W S OK | Context\n\n/ | 0 | task-1-subtask-1-tests \n/ | 0 | p_red() \nx | 1 3 | p_red() [0.1s]\n--------------------------------------------------------------------------------\nFailure ('test-task-1-subtask-1-tests.R:21:3'): p_red()\np_red(boxes = boxes) not equivalent to 0.5.\n1/1 mismatches\n[1] 0.393 - 0.5 == -0.107\nError: Incorrect result for matrix(c(1,1,1,1,1,1), ncol = 2)\n--------------------------------------------------------------------------------\n\n/ | 0 | task-2-subtask-1-tests \n/ | 0 | p_box() \nx | 1 3 | p_box()\n--------------------------------------------------------------------------------\nFailure ('test-task-2-subtask-1-tests.R:19:3'): p_box()\np_box(boxes = boxes) not equivalent to c(0.4, 0.1, 0.5).\n3/3 mismatches (average diff: 0.0909)\n[1] 0.2909 - 0.4 == -0.1091\n[2] 0.0727 - 0.1 == -0.0273\n[3] 0.6364 - 0.5 == 0.1364\nError: Incorrect result for matrix(c(1,1,1,1,1,1), ncol = 2)\n--------------------------------------------------------------------------------\n\n/ | 0 | task-3-subtask-1-tests \n/ | 0 | p_identical_twin() \nx | 2 3 | p_identical_twin()\n--------------------------------------------------------------------------------\nFailure ('test-task-3-subtask-1-tests.R:16:3'): p_identical_twin()\np_identical_twin(fraternal_prob = 1/100, identical_prob = 1/500) not equivalent to 0.2857143.\n1/1 mismatches\n[1] 0.455 - 0.286 == 0.169\nError: Incorrect result for fraternal_prob = 1/100 and identical_prob = 1/500\n\nFailure ('test-task-3-subtask-1-tests.R:19:3'): p_identical_twin()\np_identical_twin(fraternal_prob = 1/10, identical_prob = 1/20) not equivalent to 0.5.\n1/1 mismatches\n[1] 0.455 - 0.5 == -0.0455\nError: Incorrect result for fraternal_prob = 1/10 and identical_prob = 1/20\n--------------------------------------------------------------------------------\n\n== Results =====================================================================\nDuration: 0.2 s\n\n[ FAIL 4 | WARN 0 | SKIP 0 | PASS 9 ]\n```\n:::\n:::\n\n\n\n:::\n::::\n\n",
"markdown": "---\ntitle: \"Assignment 1\"\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\neditor: source\n---\n\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 1](assignment1.html). You can download the [qmd-file](https://avehtari.github.io/BDA_course_Aalto/assignments/template1.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::: {.cell}\n\n```{.r .cell-code}\nlibrary(markmyassignment)\nassignment_path = paste(\"https://github.com/avehtari/BDA_course_Aalto/\",\n\"blob/master/assignments/tests/assignment1.yml\", sep=\"\")\nset_assignment(assignment_path)\n```\n\n::: {.cell-output .cell-output-stderr}\n```\nAssignment set:\nassignment1: Bayesian Data Analysis: Assignment 1\nThe assignment contain the following (3) tasks:\n- p_red\n- p_box\n- p_identical_twin\n```\n:::\n:::\n\n\n\n:::\n::::\n\n\n# Basic probability theory notation and terms\n\nWrite your answers here!\n\n\n\n# Basic computer skills\n\nDo some setup here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Do some setup:\ndistribution_mean = .2\ndistribution_variance = .01\n\n# You have to compute the parameters below from the given mean and variance\n# distribution_alpha = ...\n# distribution_beta = ...\n```\n:::\n\n\n\n\n\n## (a)\n\n\nPlot the PDF here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: seq(), plot() and dbeta()\n```\n:::\n\n\n\n\n\n## (b)\n\n\nSample and plot the histogram here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: rbeta() and hist()\n```\n:::\n\n\n\n\n\n## (c)\n\n\nCompute the sample mean and variance here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: mean() and var()\n```\n:::\n\n\n\n\n\n## (d)\n\n\nCompute the central interval here. Explain in text what you do.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Useful functions: quantile()\n```\n:::\n\n\n\n\n# Bayes' theorem 1\n\n## (a)\n\n\nCompute the quantities needed to justify your recommendation here. Explain in text what you do.\nYou can do the computation with pen and paper or in R.\nEither way, you have to explain why you compute what you compute.\n\nIf you use pen and paper, you can include scans or pictures as follows (see also [assignment_instructions#fig-workflow](assignment_instructions#fig-workflow)):\n\n![Parts of Bayesian workflow](additional_files/bayes_workflow.jpg){#fig-workflow width=\"350\"}\n\nSee @fig-workflow for illustration of parts of Bayesian workflow.\n\n\n# Bayes' theorem 2\n\nYou will need to change the numbers to the numbers in the exercise.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nboxes_test <- matrix(c(2,2,1,5,5,1), ncol = 2,\n dimnames = list(c(\"A\", \"B\", \"C\"), c(\"red\", \"white\")))\n```\n:::\n\n\n\n\n\n## (a)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_red <- function(boxes) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n 0.3928571\n}\n```\n:::\n\n\n\n\n\n## (b)\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_box <- function(boxes) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n c(0.29090909,0.07272727,0.63636364)\n}\n```\n:::\n\n\n\n\n# Bayes' theorem 3\n\n## (a)\n\n\nYou will need to change the numbers to the numbers in the exercise.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nfraternal_prob = 1/125\nidentical_prob = 1/300\n```\n:::\n\n\nKeep the below name and format for the function to work with `markmyassignment`:\n\n\n::: {.cell}\n\n```{.r .cell-code}\np_identical_twin <- function(fraternal_prob, identical_prob) {\n # Do computation here, and return as below.\n # This is the correct return value for the test data provided above.\n 0.4545455\n}\n```\n:::\n\n\n\n\n# The three steps of Bayesian data analysis\n\n## (a)\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::: {.cell}\n\n```{.r .cell-code}\nmark_my_assignment()\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nv | F W S OK | Context\n\n/ | 0 | task-1-subtask-1-tests \n/ | 0 | p_red() \nx | 1 3 | p_red()\n--------------------------------------------------------------------------------\nFailure ('test-task-1-subtask-1-tests.R:21:3'): p_red()\np_red(boxes = boxes) not equivalent to 0.5.\n1/1 mismatches\n[1] 0.393 - 0.5 == -0.107\nError: Incorrect result for matrix(c(1,1,1,1,1,1), ncol = 2)\n--------------------------------------------------------------------------------\n\n/ | 0 | task-2-subtask-1-tests \n/ | 0 | p_box() \nx | 1 3 | p_box()\n--------------------------------------------------------------------------------\nFailure ('test-task-2-subtask-1-tests.R:19:3'): p_box()\np_box(boxes = boxes) not equivalent to c(0.4, 0.1, 0.5).\n3/3 mismatches (average diff: 0.0909)\n[1] 0.2909 - 0.4 == -0.1091\n[2] 0.0727 - 0.1 == -0.0273\n[3] 0.6364 - 0.5 == 0.1364\nError: Incorrect result for matrix(c(1,1,1,1,1,1), ncol = 2)\n--------------------------------------------------------------------------------\n\n/ | 0 | task-3-subtask-1-tests \n/ | 0 | p_identical_twin() \nx | 2 3 | p_identical_twin()\n--------------------------------------------------------------------------------\nFailure ('test-task-3-subtask-1-tests.R:16:3'): p_identical_twin()\np_identical_twin(fraternal_prob = 1/100, identical_prob = 1/500) not equivalent to 0.2857143.\n1/1 mismatches\n[1] 0.455 - 0.286 == 0.169\nError: Incorrect result for fraternal_prob = 1/100 and identical_prob = 1/500\n\nFailure ('test-task-3-subtask-1-tests.R:19:3'): p_identical_twin()\np_identical_twin(fraternal_prob = 1/10, identical_prob = 1/20) not equivalent to 0.5.\n1/1 mismatches\n[1] 0.455 - 0.5 == -0.0455\nError: Incorrect result for fraternal_prob = 1/10 and identical_prob = 1/20\n--------------------------------------------------------------------------------\n\n== Results =====================================================================\nDuration: 0.2 s\n\n[ FAIL 4 | WARN 0 | SKIP 0 | PASS 9 ]\n```\n:::\n:::\n\n\n\n:::\n::::\n\n",
"supporting": [
"template1_files"
],
Expand Down
Loading

0 comments on commit 99857dc

Please sign in to comment.