Simple Numerical Modeling in R – Part 2: Exercises
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Exercise 1
Recall the previous initial values of all parameters (t,k,S,ntimesteps, time step). It is better to use the same script as the previous exercise so that we can directly compare the original models to the modified one (based on error fixing approach on this exercise). Create a new empty matrix to store the following result of the calculation.
Exercise 2
Create a loop of calculation that includes the rounding up process.
Exercise 3
Plot the revised model on the same graph as the plot of the original model. Make notes of the performance of the model and where the error on the model occurred.
Exercise 4
Now, what happens if we change the time step? Recall all parameters on the original model, but change the final time step. Create a new output matrix for the output.
Exercise 5
Re-run the loop with the new parameter.
Exercise 6
Re-plot the original model and plot the time step reduced model. Models with longer time steps simulate lower water levels; why? How do we investigate which one is closer to the correct values?
Exercise 7
Create a regression equation from the data-set. Use it to compare results from analytical (regression equation) and the latest revised model visually. What can be inferred from it?
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.