inst/examples/appendices/knit_sources/validating_approximation_knit_.md

In the case of the simulated model, we can compare our process of simulating under the approximate models, OU and LSN, to what we would have gotten if we could simulate under the true process.

Now we create the replicates by simulating under the original model. We will not try to estimate the nonlinear model first, as we generally do not have the power to do this well (but see my notes attempting this anyway).

We tidy up the data a bit

We can set up a parallel envirnoment for a multicore machine,

We can now fit the LSN model to each of these replicates,

and look at the distribution of parameters.

We compare this to simulating replicates from the approximate model and restimating parameters. We will use the model average parameters as the parameters for a model that will generate our simulations.

We simulate \Sexpr{nreps} as before,

<--begin.rcode simulate2 Y <- simulate(B, nreps) dat_approx <- melt(Y) names(dat_approx) = c("time", "rep", "population") end.rcode-->

And now we are ready to estimate again:

We can just compare these to get a sense of how did. <!--begin.rcode p <- data.frame(t(p)) p_approx <- data.frame(t(p_approx)) sapply(p, mean) sapply(p, var) sapply(p_approx, mean) sapply(p_approx, var)

save(list=ls(), file="validating.rda") end.rcode-->



cboettig/earlywarning documentation built on May 13, 2019, 2:07 p.m.