{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "using Distributions, Turing, StatsPlots, Random, RDatasets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Assignment 2: hierarchical models\n", "\n", "Students|\n", "-------|\n", "\n", "Name | Id\n", "------------|----------\n", "Ploni Almoni|123489589\n", "John Smith |923352302\n", "\n", "## Summary\n", "\n", "In this assignment we explore hierarchical models for analysis of data consisting of multiple related groups. The assignment is based on the [class material](https://bgu-abda.bitbucket.io/#lectures): \n", "\n", "5. Hierarchical models\n", "6. Hierarchical models, cont.\n", "\n", "The assignment consists of two problems. Solve the problems in either Jupyter or Pluto notebook.\n", "In addition to computations, solutions must include **graphical visualization** and **numerical characterization** of the posterior." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem 1: warp breaks\n", "\n", "Julia provides to [R datasets](https://www.rdocumentation.org/packages/datasets/versions/3.6.2) via package RDatasets. We will use the [warpbreaks](https://www.rdocumentation.org/packages/datasets/versions/3.6.2/topics/warpbreaks) dataset for this problem. You can load the dataset into data frame `df` as follows:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "df = RDatasets.dataset(\"datasets\", \"warpbreaks\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Infer the probability distribution of warp breaks for each of two wool types. Compare the results under separate and hierarchical models. Conduct two studies:\n", "\n", "1. Ignore warp tension and compare wool types based on all experiments. \n", "2. Account for warp tension in both the hierarchical model and the separate model." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem 2. City of Norfolk employee salaries\n", "\n", "City of Norfolk provides access to [employee salary data](https://data.norfolk.gov/Government/Employee-Salaries/4fsk-z8s8). Analyze the salary distributions \n", "\n", "1. by department;\n", "2. by department and employee status.\n", "\n", "Compare the analysis under separate and hierarchical models. A small number of groups are very different from the rest, how do you propose to handle the difference in the hierarchical model?" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.6.0", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.0" } }, "nbformat": 4, "nbformat_minor": 5 }