# Simple Numerical Modeling in R – Part 2: Exercises

**R-exercises**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In this exercise, we will continue to build our model from our previous exercise here, specifically to revise the errors that may be generated from the model, including rounding and truncating errors.

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?

**leave a comment**for the author, please follow the link and comment on their blog:

**R-exercises**.

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.