March 2019
Beginner to intermediate
448 pages
13h 14m
English
In this recipe, we will generate a synthetic dataset using R techniques. This will contain just one independent variable and one random effect. We will have 100 groups with 10 members each. We will choose a nonlinear relationship that exhibits saturation effects. As it has been stated previously, this is usually, this is usually fitted using quadrature methods, which are slightly more involved. Instead, we will approximate the integrals using standard Monte Carlo simulation; this will be much slower, but it will be easier to understand.
set.seed(10) X = 7*runif(1000) G = c() for (x in 1:100){ G = c(G,rep(x,10)) } pre____frame = cbind(X=X,G=G,NOISE = rnorm(1000,0,0.03)) shocks_frame = ...Read now
Unlock full access