Forecasting

Using the Simulation Object Backward

August 23, 2017

I’m using the Simulation Object in MetrixND to weather normalize historic sales. When configured, the object allows me to simulate the model replacing the X variables with a scenario. In weather normalization, the simulated X variables are the normal weather heating and cooling variables.  My simulation is shown below.



When I select the “eyeglasses” and view the results, I notice a peculiar situation.  I’m missing results from 2010 through 2012.  I can see the missing values in the “Actual vs. Predicted” graph as shown below.



Why am I missing results from 2010 through 2012? Looking closely, I see my model is estimated from 2013 through 2015. The Simulation Object develops the simulated values using the Model Predicted values, so the Model cannot calculate a simulated value because it does not have Predicted values prior to 2013.



A simple, but incorrect, solution to the problem is to change the model estimation period to include 2010 through 2012 data. The problem with this solution is that the weather coefficients will change when these data are added.  I chose to estimate the model from 2013 forward because I did not want 2010 through 2012 data to influence the weather normalization process.

The correct solution is to change the model estimation period to include the 2010 through 2012 data AND mark these data as “bad.”

To mark the data as “bad,”I create a binary variable named “Remove” with the equation “Year <= 2013” as shown below.



This variable returns a value of “1” for all dates prior to 2013 and a value of “0” for all dates beginning in 2013.  Then, I insert this variable, “Remove” into the bad box in the regression form as shown below.



By marking 2010 to 2012 as bad, the model coefficients are not influenced by these data.  However, the model will still calculate a predicted value which is used in the Simulation Object.  The simulation object calculates the results beginning in 2010 which are seen in the “Actual vs. Predicted” graph.



With the full simulation results, I finish normalizing my historic sales.

Wystąpił błąd podczas przetwarzania szablonu.
The following has evaluated to null or missing:
==> authorContent.contentFields  [in template "44616#44647#114455" at line 9, column 17]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: contentFields = authorContent.content...  [in template "44616#44647#114455" at line 9, column 1]
----
1<#assign 
2	webContentData = jsonFactoryUtil.createJSONObject(author.getData()) 
3	classPK = webContentData.classPK 
4/> 
5 
6<#assign 
7authorContent = restClient.get("/headless-delivery/v1.0/structured-contents/" + classPK + "?fields=contentFields%2CfriendlyUrlPath%2CtaxonomyCategoryBriefs") 
8contentFields = authorContent.contentFields 
9categories=authorContent.taxonomyCategoryBriefs 
10authorContentData = jsonFactoryUtil.createJSONObject(authorContent) 
11friendlyURL = authorContentData.friendlyUrlPath 
12authorCategoryId = "0" 
13/> 
14 
15<#list contentFields as contentField > 
16   <#assign  
17	 contentFieldData = jsonFactoryUtil.createJSONObject(contentField)  
18	 name = contentField.name 
19	 /> 
20	 <#if name == 'authorImage'> 
21	    <#if (contentField.contentFieldValue.image)??> 
22	        <#assign authorImageURL = contentField.contentFieldValue.image.contentUrl />	 
23			</#if> 
24	 </#if> 
25	 <#if name == 'authorName'> 
26	    <#assign authorName = contentField.contentFieldValue.data /> 
27			<#list categories as category > 
28         <#if authorName == category.taxonomyCategoryName> 
29				     <#assign authorCategoryId = category.taxonomyCategoryId /> 
30				 </#if> 
31      </#list> 
32	 </#if> 
33	 <#if name == 'authorDescription'> 
34	    <#assign authorDescription = contentField.contentFieldValue.data /> 
35			 
36	 </#if> 
37	  
38	 <#if name == 'authorJobTitle'> 
39	    <#assign authorJobTitle = contentField.contentFieldValue.data /> 
40			 
41	 </#if> 
42 
43</#list> 
44 
45<div class="blog-author-info"> 
46	<#if authorImageURL??> 
47		<img class="blog-author-img" id="author-image" src="${authorImageURL}" alt="" /> 
48	</#if> 
49	<#if authorName??> 
50		<#if authorName != ""> 
51			<p class="blog-author-name">By <a id="author-detail-page" href="/w/${friendlyURL}?filter_category_552298=${authorCategoryId}"><span id="author-full-name">${authorName}</span></a></p> 
52			<hr /> 
53		</#if> 
54	</#if> 
55	<#if authorJobTitle??> 
56		<#if authorJobTitle != ""> 
57			<p class="blog-author-title" id="author-job-title" >${authorJobTitle}</p> 
58			<hr /> 
59		</#if> 
60	</#if> 
61	<#if authorDescription??> 
62		<#if authorDescription != "" && authorDescription != "null" > 
63			<p class="blog-author-desc" id="author-job-desc">${authorDescription}</p> 
64			<hr /> 
65		</#if> 
66	</#if> 
67</div>