Here you will find daily news and tutorials about R, contributed by hundreds of bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

[This article was first published on 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.

Numerical modelling is a foundation of machine learning. Learn more about machine learning in the online course
Regression Machine Learning with R. In this course, you will learn how to:

build a machine learning model from scratch,

Learn how to tweak and improve your model,

And much more

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?