{"id":1134,"date":"2023-10-01T20:53:31","date_gmt":"2023-10-02T00:53:31","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/?post_type=chapter&#038;p=1134"},"modified":"2024-09-24T20:42:23","modified_gmt":"2024-09-25T00:42:23","slug":"fitting-time-series-with-true-values","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/chapter\/fitting-time-series-with-true-values\/","title":{"raw":"Tutorial: Fitting time series with true values","rendered":"Tutorial: Fitting time series with true values"},"content":{"raw":"<p style=\"font-weight: 400\">In a previous tutorial we fitted the Anchovy Bay model to a simple time series file, mainly in order to explore the time series fitting procedures of Ecosim in a simple manner. Here, we will expand on this, notably by evaluate fitting when considering fisheries, food web, and environmental conditions, i.e. we add an environmental forcing function.<\/p>\r\n<p style=\"font-weight: 400\">The present tutorial is a test to see how well Ecosim can fit a model with known parameters. The time series 'data' for this tutorial were thus derived from a model run with known primary production forcing and with known vulnerability multipliers. Can we retrieve those values?<\/p>\r\n<p style=\"font-weight: 400\">Open the model <em>Anchovy Bay true.ewemdb<\/em> (<a href=\"https:\/\/ln5.sync.com\/dl\/20358ca30\/9zdktdsp-hiphthjc-gxetndrk-pgr4vvc4\">download<\/a>); then load the <em>anch bay<\/em> scenario, and then the <em>anchovybay true time<\/em> series, (which is also available in the <em>anchovybay true.csv<\/em> time series file).<\/p>\r\n<p style=\"font-weight: 400\">Reset the vulnerability multipliers to the default: <em>Ecosim &gt; Input &gt; Vulnerabilities<\/em>. Click the upper left cell in the spreadsheet (above 1 and to the left of Prey\\predator), to select the entire sheet, then enter the value 2 in <em>Set:<\/em> at the upper right, and click <em>Apply<\/em> to the right.<\/p>\r\n<p style=\"font-weight: 400\">Run the model, <em>Ecosim &gt; Output &gt; Run Ecosim &gt; Run<\/em> button. Check the output, notably on the Ecosim Group plots. As an example of what to look for, examine the cod screen. The model shows bigger decline in biomass than the data. What does that tell us about the vulnerability multiplier for cod?<\/p>\r\n<p style=\"font-weight: 400\">Check the <em>Ecosim &gt; Input &gt; Forcing<\/em> function form where you should find two forcing functions, <em>1: True PP<\/em>, (which we will use later for comparisons), and <em>2: Fitting<\/em>, (which we will use for fitting). Check the <em>Ecosim &gt; Input &gt; Forcing function &gt; Apply FF<\/em> (producer) form. Here there should be an <em>F2<\/em>\u00a0in the (single not blocked entry field) for Phytoplankton (if not, then click the empty field and select the FF.\u00a0 The two forcing functions are, by the way, included in the time series file, and when\/if you read it in, you\u2019ll have to specify that you do not want to read in each of these as monthly values.<\/p>\r\n<p style=\"font-weight: 400\">Now go <em>Ecosim &gt; Tools &gt; Fit<\/em> to time series. Try running a number of different fits; first with vulnerability search only. E.g., search groups with time series, and search for vulnerability multipliers for the seven groups with time series. Note what the 'base' SS is, and what you get with seven estimated parameters, probably a substantial reduction in SS. Try also to estimate fewer vulnerability multipliers. Also search for most sensitive parameters, and try with different number of parameters. Which groups are most\/least sensitive? Are there any implications to be deducted from this? Notably consider if we are likely to have or get time series for the more sensitive groups.<\/p>\r\n<p style=\"font-weight: 400\">For each run it is always a good practice to check the vulnerability form to see the estimated multipliers.<\/p>\r\n<p style=\"font-weight: 400\">Also compare vulnerability multiplier fitting with searches by predator and by predator\/prey combinations. As a rule, we find that searches by predator are most efficient \u2013 and easier to explain.<\/p>\r\n<p style=\"font-weight: 400\">Reset the vulnerability multipliers. Now search for a primary production anomaly; check the <em>Anomaly search<\/em> on the Fit to time series form, and uncheck the <em>Vulnerability search<\/em>, so only search for an environmental signal. Before each run go to Ecosim, Input data, Forcing functions, and reset the shape of the Fitting forcing function. Try with different number of spline points, e.g., 2, 3, 4, 6, 10, and finally 0 (i.e. annual PP). Do you see clear environmental signals? Evaluate not just SS, but also if the anomalies are plausible (there can be a tendency to cut off or wildly increase PP at the beginning or end of time series as this often can be done without time series 'penalty'). Based on this, select one or several number of spline points to test for the combined Vulnerability and Anomaly search \u2013 try such runs.<\/p>\r\n<p style=\"font-weight: 400\">When you\u2019ve done runs to fit, copy the results from the table on the Fit to time series form to a spreadsheet (so you don\u2019t lose them). Evaluate AIC<sub>c<\/sub> values, and consider implications for model selection.<\/p>\r\n\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Consider how well the fitting routine is able to find the PP anomalies and vulnerabilities.<\/li>\r\n \t<li style=\"font-weight: 400\">Discuss the findings and their implications.<\/li>\r\n<\/ul>\r\n<div style=\"font-weight: 400\">\r\n<div class=\"textbox shaded\"><strong>Optional\r\n<\/strong>There is an additional time series in the model database, \u201canchovybay true partial\u201d. It is similar to the previous, but omits a number of early time series values that help identify the cycling pattern. Try this time series to consider the effect of having time series with contrast.<\/div>\r\n&nbsp;\r\n\r\n<\/div>\r\n<div class=\"textbox textbox--key-takeaways\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\"><strong>Vulnerability multipliers for the Anchovy Bay model\u00a0<\/strong><\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<p style=\"font-weight: 400\">Your model version may be a bit changed from what\u2019s below, but should be close<\/p>\r\n\r\n<table style=\"font-weight: 400\">\r\n<tbody>\r\n<tr>\r\n<td>1<\/td>\r\n<td>Whales<\/td>\r\n<td>1.14<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>2<\/td>\r\n<td>Seals<\/td>\r\n<td>2.38<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>3<\/td>\r\n<td>Cod<\/td>\r\n<td>1.28<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>4<\/td>\r\n<td>Whiting<\/td>\r\n<td>6.17<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>5<\/td>\r\n<td>Mackerel juv<\/td>\r\n<td>1.10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>6<\/td>\r\n<td>Mackerel ad<\/td>\r\n<td>1.60<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>7<\/td>\r\n<td>Anchovy<\/td>\r\n<td>1.21<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>8<\/td>\r\n<td>Shrimp<\/td>\r\n<td>&gt;1000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>9<\/td>\r\n<td>Benthos<\/td>\r\n<td>3.22<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>10<\/td>\r\n<td>Zooplankton<\/td>\r\n<td>2.26<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<\/div>\r\n<p style=\"font-weight: 400\"><\/p>","rendered":"<p style=\"font-weight: 400\">In a previous tutorial we fitted the Anchovy Bay model to a simple time series file, mainly in order to explore the time series fitting procedures of Ecosim in a simple manner. Here, we will expand on this, notably by evaluate fitting when considering fisheries, food web, and environmental conditions, i.e. we add an environmental forcing function.<\/p>\n<p style=\"font-weight: 400\">The present tutorial is a test to see how well Ecosim can fit a model with known parameters. The time series &#8216;data&#8217; for this tutorial were thus derived from a model run with known primary production forcing and with known vulnerability multipliers. Can we retrieve those values?<\/p>\n<p style=\"font-weight: 400\">Open the model <em>Anchovy Bay true.ewemdb<\/em> (<a href=\"https:\/\/ln5.sync.com\/dl\/20358ca30\/9zdktdsp-hiphthjc-gxetndrk-pgr4vvc4\">download<\/a>); then load the <em>anch bay<\/em> scenario, and then the <em>anchovybay true time<\/em> series, (which is also available in the <em>anchovybay true.csv<\/em> time series file).<\/p>\n<p style=\"font-weight: 400\">Reset the vulnerability multipliers to the default: <em>Ecosim &gt; Input &gt; Vulnerabilities<\/em>. Click the upper left cell in the spreadsheet (above 1 and to the left of Prey\\predator), to select the entire sheet, then enter the value 2 in <em>Set:<\/em> at the upper right, and click <em>Apply<\/em> to the right.<\/p>\n<p style=\"font-weight: 400\">Run the model, <em>Ecosim &gt; Output &gt; Run Ecosim &gt; Run<\/em> button. Check the output, notably on the Ecosim Group plots. As an example of what to look for, examine the cod screen. The model shows bigger decline in biomass than the data. What does that tell us about the vulnerability multiplier for cod?<\/p>\n<p style=\"font-weight: 400\">Check the <em>Ecosim &gt; Input &gt; Forcing<\/em> function form where you should find two forcing functions, <em>1: True PP<\/em>, (which we will use later for comparisons), and <em>2: Fitting<\/em>, (which we will use for fitting). Check the <em>Ecosim &gt; Input &gt; Forcing function &gt; Apply FF<\/em> (producer) form. Here there should be an <em>F2<\/em>\u00a0in the (single not blocked entry field) for Phytoplankton (if not, then click the empty field and select the FF.\u00a0 The two forcing functions are, by the way, included in the time series file, and when\/if you read it in, you\u2019ll have to specify that you do not want to read in each of these as monthly values.<\/p>\n<p style=\"font-weight: 400\">Now go <em>Ecosim &gt; Tools &gt; Fit<\/em> to time series. Try running a number of different fits; first with vulnerability search only. E.g., search groups with time series, and search for vulnerability multipliers for the seven groups with time series. Note what the &#8216;base&#8217; SS is, and what you get with seven estimated parameters, probably a substantial reduction in SS. Try also to estimate fewer vulnerability multipliers. Also search for most sensitive parameters, and try with different number of parameters. Which groups are most\/least sensitive? Are there any implications to be deducted from this? Notably consider if we are likely to have or get time series for the more sensitive groups.<\/p>\n<p style=\"font-weight: 400\">For each run it is always a good practice to check the vulnerability form to see the estimated multipliers.<\/p>\n<p style=\"font-weight: 400\">Also compare vulnerability multiplier fitting with searches by predator and by predator\/prey combinations. As a rule, we find that searches by predator are most efficient \u2013 and easier to explain.<\/p>\n<p style=\"font-weight: 400\">Reset the vulnerability multipliers. Now search for a primary production anomaly; check the <em>Anomaly search<\/em> on the Fit to time series form, and uncheck the <em>Vulnerability search<\/em>, so only search for an environmental signal. Before each run go to Ecosim, Input data, Forcing functions, and reset the shape of the Fitting forcing function. Try with different number of spline points, e.g., 2, 3, 4, 6, 10, and finally 0 (i.e. annual PP). Do you see clear environmental signals? Evaluate not just SS, but also if the anomalies are plausible (there can be a tendency to cut off or wildly increase PP at the beginning or end of time series as this often can be done without time series &#8216;penalty&#8217;). Based on this, select one or several number of spline points to test for the combined Vulnerability and Anomaly search \u2013 try such runs.<\/p>\n<p style=\"font-weight: 400\">When you\u2019ve done runs to fit, copy the results from the table on the Fit to time series form to a spreadsheet (so you don\u2019t lose them). Evaluate AIC<sub>c<\/sub> values, and consider implications for model selection.<\/p>\n<ul>\n<li style=\"font-weight: 400\">Consider how well the fitting routine is able to find the PP anomalies and vulnerabilities.<\/li>\n<li style=\"font-weight: 400\">Discuss the findings and their implications.<\/li>\n<\/ul>\n<div style=\"font-weight: 400\">\n<div class=\"textbox shaded\"><strong>Optional<br \/>\n<\/strong>There is an additional time series in the model database, \u201canchovybay true partial\u201d. It is similar to the previous, but omits a number of early time series values that help identify the cycling pattern. Try this time series to consider the effect of having time series with contrast.<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"textbox textbox--key-takeaways\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\"><strong>Vulnerability multipliers for the Anchovy Bay model\u00a0<\/strong><\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p style=\"font-weight: 400\">Your model version may be a bit changed from what\u2019s below, but should be close<\/p>\n<table style=\"font-weight: 400\">\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Whales<\/td>\n<td>1.14<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Seals<\/td>\n<td>2.38<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Cod<\/td>\n<td>1.28<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>Whiting<\/td>\n<td>6.17<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>Mackerel juv<\/td>\n<td>1.10<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>Mackerel ad<\/td>\n<td>1.60<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>Anchovy<\/td>\n<td>1.21<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>Shrimp<\/td>\n<td>&gt;1000<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>Benthos<\/td>\n<td>3.22<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>Zooplankton<\/td>\n<td>2.26<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p style=\"font-weight: 400\">\n","protected":false},"author":1909,"menu_order":12,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[49],"contributor":[],"license":[],"class_list":["post-1134","chapter","type-chapter","status-publish","hentry","chapter-type-numberless"],"part":1094,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/users\/1909"}],"version-history":[{"count":4,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/1134\/revisions"}],"predecessor-version":[{"id":2902,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/1134\/revisions\/2902"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/parts\/1094"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapters\/1134\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/pressbooks\/v2\/chapter-type?post=1134"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/contributor?post=1134"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/ewemodel\/wp-json\/wp\/v2\/license?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}