<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/simple-numerical-modeling-in-r-part-2-exercises/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.r-exercises.com/2018/04/07/simple-numerical-modelling-in-r-exercises-part-2/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><div class="wp-caption"><a rel="nofollow" href="https://i0.wp.com/www.r-exercises.com/wp-content/uploads/2018/03/water-splash-wallpaper-3.jpg?ssl=1" target="_blank"><img sizes="(max-width: 150px) 100vw, 150px" src="https://i1.wp.com/www.r-exercises.com/wp-content/uploads/2018/03/water-splash-wallpaper-3-150x150.jpg?resize=150%2C150&ssl=1" alt="" width="150" class="wp-image-10938" data-recalc-dims="1" height="150"></a>
<p class="wp-caption-text">http://eskipaper.com/images/water-splash-wallpaper-3.jpg</p>
</div>
<p>In this exercise, we will continue to build our model from our previous exercise <a rel="nofollow" href="https://www.r-exercises.com/2018/03/24/simple-numerical-modelling-in-r-exercises-part-1/" target="_blank">here</a>, specifically to revise the errors that may be generated from the model, including rounding and truncating errors.<br>
Answers to these exercises are available <a rel="nofollow" href="http://r-exercises.com/2018/04/07/simple-numerical-modelling-in-r-solutions-part-2/" target="_blank">here</a>. 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.</p>
<p><strong>Exercise 1</strong><br>
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.</p>
<p><strong>Exercise 2</strong><br>
Create a loop of calculation that includes the rounding up process.</p>
<p><strong>Exercise 3</strong><br>
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.</p>
<p><strong>Exercise 4</strong><br>
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.</p>
<div>
<aside><img src="https://www.r-exercises.com/2018/04/07/simple-numerical-modelling-in-r-exercises-part-2/"></aside>
<div>Numerical modelling is a foundation of machine learning. <strong>Learn more</strong> about machine learning in the online course <a rel="nofollow" href="https://www.r-exercises.com/product/regression-machine-learning-with-r/" target="_blank"><br>
Regression Machine Learning with R</a>. In this course, you will learn how to:
<ul>
<li>build a machine learning model from scratch,</li>
<li>Learn how to tweak and improve your model,</li>
<li>And much more</li>
</ul>
</div>
</div>
<p><strong>Exercise 5</strong><br>
Re-run the loop with the new parameter.</p>
<p><strong>Exercise 6</strong><br>
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?</p>
<p><strong>Exercise 7</strong><br>
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?</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="https://www.r-exercises.com/2016/04/06/3d-plotting-exercises/" title="3D plotting exercises" target="_blank">3D plotting exercises </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2017/01/08/descriptive-analytics-part-6-interactive-dashboard-22/" title="Descriptive Analytics-Part 6: Interactive dashboard ( 2/2)" target="_blank">Descriptive Analytics-Part 6: Interactive dashboard ( 2/2) </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/02/11/bayesian-inference-mcmc-diagnostics-using-coda/" title="Bayesian Inference – MCMC Diagnostics using coda : Exercises" target="_blank">Bayesian Inference – MCMC Diagnostics using coda : Exercises </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.r-exercises.com/2018/04/07/simple-numerical-modelling-in-r-exercises-part-2/"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/0bdpzzyKbQk" height="1"></a></div>