The simulation study approximates the covariance very well, with the simulated and analytic covariances lying within approximately 0.1 (depending on the simulation) of each other.
(ggplot(data = simstudy) +geom_point(aes(x = x, y = y), alpha =0.5, size =0.5)+geom_point(aes(x =5, y=5), col ='red')+facet_grid(rho~sigx+sigy, labeller = label_both)+theme_bw())
Warning in geom_point(aes(x = 5, y = 5), col = "red"): All aesthetics have length 1, but the data has 200000 rows.
ℹ Please consider using `annotate()` or provide this layer with data containing
a single row.
Question 7
N <-10000(simstudy_1 <-data.frame(x =rexp(N,1))%>%mutate(y = x +rexp(N,1))) %>% head
x y
1 0.42121470 0.6018134
2 2.13490780 2.3286536
3 0.05156102 0.8476295
4 0.55439325 1.5502714
5 0.53949357 0.5980236
6 0.23527863 1.2999947