--- title: "Lab 2" author: "Name here" output: html_document --- Please use D2L to turn in both the HTML output and your R Markdown file in. ## Q1. (10 pts) Simulate the Mean and Variance of samples from a uniform(0,1) distribution. ## Q2 (15 pts) Recall the mixture distribution from HW1 ```{r, echo=F} inches <- seq(0,10, by= .01) density <- dgamma(seq(0, 10, by=.01), 5, 1.5) * .5 density[1] <- density[1] + .5 plot(inches, density, type='l', lwd=2, main='Probability of Snow Tomorrow ', xlab = 'Inches', ylab = '') ``` ### a (5 pts) Estimate the 95% HDI for this distribution. ### b (10 pts) Use the code below to take samples and estimate the mean and variance of this distribution. ```{r} num.samples <- 1000 samples <- ifelse(runif(1000) < .5, 0, 1) samples[samples == 1] <- rgamma(sum(samples),5,1.5) ```