Bug 565455 - The STEM AI plugin called "Automatic Experiments" requires
a more flexible and configurable error function

This patch from  Vishrawas Gopalakrishnan implements the feature request
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/META-INF/MANIFEST.MF b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/META-INF/MANIFEST.MF
index 5635236..cd752fe 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/META-INF/MANIFEST.MF
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/META-INF/MANIFEST.MF
@@ -2,19 +2,25 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.stem.analysis;singleton:=true
+Automatic-Module-Name: org.eclipse.stem.analysis
 Bundle-Version: 3.0.0.qualifier
 Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.stem.analysis.provider.AnalysisEditPlugin$Implementation
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.eclipse.stem.analysis,
  org.eclipse.stem.analysis.impl,
+ org.eclipse.stem.analysis.presentation,
  org.eclipse.stem.analysis.provider,
  org.eclipse.stem.analysis.util
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.emf.edit.ui;visibility:=reexport,
  org.eclipse.jface,
  org.eclipse.stem.core,
- org.eclipse.core.resources,
- org.eclipse.ui.ide
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.ui.ide;visibility:=reexport
 Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.ecore b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.ecore
index 0278d88..75eba99 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.ecore
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.ecore
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
-    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="analysis"
-    nsURI="http:///org/eclipse/stem/analysis.ecore" nsPrefix="org.eclipse.stem.analysis">
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="analysis" nsURI="http:///org/eclipse/stem/analysis.ecore" nsPrefix="org.eclipse.stem.analysis">
   <eClassifiers xsi:type="ecore:EClass" name="ErrorFunction">
     <eOperations name="calculateError" eType="#//ErrorResult">
       <eParameters name="reference" eType="#//ReferenceScenarioDataMap"/>
@@ -36,4 +34,9 @@
     </eStructuralFeatures>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="validationError" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
   </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="CompoundErrorFunction" eSuperTypes="#//ErrorFunction">
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="useDeaths" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="useCumSum" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="useDaily" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+  </eClassifiers>
 </ecore:EPackage>
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.genmodel b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.genmodel
index 111db67..5e22d64 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.genmodel
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/model/analysis.genmodel
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0"
-    xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
-    xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.stem.analysis/src"
-    editDirectory="/org.eclipse.stem.analysis/src" editorDirectory="/org.eclipse.stem.analysis/src"
-    modelPluginID="org.eclipse.stem.analysis" modelName="Analysis" testsDirectory="/org.eclipse.stem.test.analysis/src"
-    importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false">
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+    xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.stem.analysis/src" editDirectory="/org.eclipse.stem.analysis/src"
+    editorDirectory="/org.eclipse.stem.analysis/src" modelPluginID="org.eclipse.stem.analysis"
+    modelName="Analysis" testsDirectory="/org.eclipse.stem.test.analysis/src" importerID="org.eclipse.emf.importer.ecore"
+    complianceLevel="5.0" copyrightFields="false">
   <foreignModel>analysis.ecore</foreignModel>
   <genPackages prefix="Analysis" basePackage="org.eclipse.stem" disposableProviderFactory="true"
       ecorePackage="analysis.ecore#/">
@@ -26,5 +25,10 @@
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute analysis.ecore#//ErrorResult/modelByTime"/>
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute analysis.ecore#//ErrorResult/validationError"/>
     </genClasses>
+    <genClasses ecoreClass="analysis.ecore#//CompoundErrorFunction">
+      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute analysis.ecore#//CompoundErrorFunction/useDeaths"/>
+      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute analysis.ecore#//CompoundErrorFunction/useCumSum"/>
+      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute analysis.ecore#//CompoundErrorFunction/useDaily"/>
+    </genClasses>
   </genPackages>
 </genmodel:GenModel>
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.properties b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.properties
index 104933c..5697b71 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.properties
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.properties
@@ -61,3 +61,7 @@
 _WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor.  Do you wish to discard this editor's changes?
 _UI_ErrorFunction_referenceDataCompartment_feature = Reference Data Compartment
 _UI_ErrorFunction_comparisonCompartment_feature = Comparison Compartment
+_UI_CompoundErrorFunction_type = Compound Error Function
+_UI_CompoundErrorFunction_useDeaths_feature = Use Deaths
+_UI_CompoundErrorFunction_useCumSum_feature = Use Cum Sum
+_UI_CompoundErrorFunction_useDaily_feature = Use Daily
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.xml b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.xml
index d640b33..bf2bdf4 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.xml
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/plugin.xml
@@ -23,6 +23,34 @@
           org.eclipse.emf.edit.provider.IItemLabelProvider
           org.eclipse.emf.edit.provider.IItemPropertySource" />
   	</extension>
+
+   <extension point="org.eclipse.ui.newWizards">
+      <!-- @generated analysis -->
+      <category
+            id="org.eclipse.emf.ecore.Wizard.category.ID"
+            name="%_UI_Wizard_category"/>
+      <wizard
+            id="org.eclipse.stem.analysis.presentation.AnalysisModelWizardID"
+            name="%_UI_AnalysisModelWizard_label"
+            class="org.eclipse.stem.analysis.presentation.AnalysisModelWizard"
+            category="org.eclipse.emf.ecore.Wizard.category.ID"
+            icon="icons/full/obj16/AnalysisModelFile.gif">
+         <description>%_UI_AnalysisModelWizard_description</description>
+         <selection class="org.eclipse.core.resources.IResource"/>
+      </wizard>
+   </extension>
+
+   <extension point="org.eclipse.ui.editors">
+      <!-- @generated analysis -->
+      <editor
+            id="org.eclipse.stem.analysis.presentation.AnalysisEditorID"
+            name="%_UI_AnalysisEditor_label"
+            icon="icons/full/obj16/AnalysisModelFile.gif"
+            extensions="analysis"
+            class="org.eclipse.stem.analysis.presentation.AnalysisEditor"
+            contributorClass="org.eclipse.stem.analysis.presentation.AnalysisActionBarContributor">
+      </editor>
+   </extension>
 	
    <extension point="org.eclipse.emf.ecore.generated_package">
       <package
@@ -41,6 +69,16 @@
            identifier="foo"
            title="%dc_desc_NELDER"/>
   </extension>
+<extension
+      point="org.eclipse.stem.analysis.errorfunction">
+      <classdef class="org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl"/>
+     <dublin_core
+           category_id="/"
+           creator="%dc_creator_vishrawas"
+           description="%dc_desc_NELDER"
+           identifier="bar"
+           title="%dc_desc_NELDER"/>
+</extension>
 
   
 </plugin>
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisFactory.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisFactory.java
index 2fd1304..3c7dbc5 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisFactory.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisFactory.java
@@ -78,6 +78,15 @@
 	ErrorResult createErrorResult();
 
 	/**
+	 * Returns a new object of class '<em>Compound Error Function</em>'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return a new object of class '<em>Compound Error Function</em>'.
+	 * @generated
+	 */
+	CompoundErrorFunction createCompoundErrorFunction();
+
+	/**
 	 * Returns the package supported by this factory.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisPackage.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisPackage.java
index 2fba557..f24790f 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisPackage.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/AnalysisPackage.java
@@ -261,6 +261,70 @@
 	int ERROR_RESULT_FEATURE_COUNT = 5;
 
 	/**
+	 * The meta object id for the '{@link org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl <em>Compound Error Function</em>}' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl
+	 * @see org.eclipse.stem.analysis.impl.AnalysisPackageImpl#getCompoundErrorFunction()
+	 * @generated
+	 */
+	int COMPOUND_ERROR_FUNCTION = 5;
+
+	/**
+	 * The feature id for the '<em><b>Reference Data Compartment</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION__REFERENCE_DATA_COMPARTMENT = ERROR_FUNCTION__REFERENCE_DATA_COMPARTMENT;
+
+	/**
+	 * The feature id for the '<em><b>Comparison Compartment</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION__COMPARISON_COMPARTMENT = ERROR_FUNCTION__COMPARISON_COMPARTMENT;
+
+	/**
+	 * The feature id for the '<em><b>Use Deaths</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION__USE_DEATHS = ERROR_FUNCTION_FEATURE_COUNT + 0;
+
+	/**
+	 * The feature id for the '<em><b>Use Cum Sum</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION__USE_CUM_SUM = ERROR_FUNCTION_FEATURE_COUNT + 1;
+
+	/**
+	 * The feature id for the '<em><b>Use Daily</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION__USE_DAILY = ERROR_FUNCTION_FEATURE_COUNT + 2;
+
+	/**
+	 * The number of structural features of the '<em>Compound Error Function</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMPOUND_ERROR_FUNCTION_FEATURE_COUNT = ERROR_FUNCTION_FEATURE_COUNT + 3;
+
+	/**
 	 * Returns the meta object for class '{@link org.eclipse.stem.analysis.ErrorFunction <em>Error Function</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -388,6 +452,49 @@
 	EAttribute getErrorResult_ValidationError();
 
 	/**
+	 * Returns the meta object for class '{@link org.eclipse.stem.analysis.CompoundErrorFunction <em>Compound Error Function</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for class '<em>Compound Error Function</em>'.
+	 * @see org.eclipse.stem.analysis.CompoundErrorFunction
+	 * @generated
+	 */
+	EClass getCompoundErrorFunction();
+
+	/**
+	 * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDeaths <em>Use Deaths</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the attribute '<em>Use Deaths</em>'.
+	 * @see org.eclipse.stem.analysis.CompoundErrorFunction#isUseDeaths()
+	 * @see #getCompoundErrorFunction()
+	 * @generated
+	 */
+	EAttribute getCompoundErrorFunction_UseDeaths();
+
+	/**
+	 * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseCumSum <em>Use Cum Sum</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the attribute '<em>Use Cum Sum</em>'.
+	 * @see org.eclipse.stem.analysis.CompoundErrorFunction#isUseCumSum()
+	 * @see #getCompoundErrorFunction()
+	 * @generated
+	 */
+	EAttribute getCompoundErrorFunction_UseCumSum();
+
+	/**
+	 * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDaily <em>Use Daily</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the attribute '<em>Use Daily</em>'.
+	 * @see org.eclipse.stem.analysis.CompoundErrorFunction#isUseDaily()
+	 * @see #getCompoundErrorFunction()
+	 * @generated
+	 */
+	EAttribute getCompoundErrorFunction_UseDaily();
+
+	/**
 	 * Returns the factory that creates the instances of the model.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -503,6 +610,36 @@
 		 * @generated
 		 */
 		EAttribute ERROR_RESULT__VALIDATION_ERROR = eINSTANCE.getErrorResult_ValidationError();
+		/**
+		 * The meta object literal for the '{@link org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl <em>Compound Error Function</em>}' class.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @see org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl
+		 * @see org.eclipse.stem.analysis.impl.AnalysisPackageImpl#getCompoundErrorFunction()
+		 * @generated
+		 */
+		EClass COMPOUND_ERROR_FUNCTION = eINSTANCE.getCompoundErrorFunction();
+		/**
+		 * The meta object literal for the '<em><b>Use Deaths</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EAttribute COMPOUND_ERROR_FUNCTION__USE_DEATHS = eINSTANCE.getCompoundErrorFunction_UseDeaths();
+		/**
+		 * The meta object literal for the '<em><b>Use Cum Sum</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EAttribute COMPOUND_ERROR_FUNCTION__USE_CUM_SUM = eINSTANCE.getCompoundErrorFunction_UseCumSum();
+		/**
+		 * The meta object literal for the '<em><b>Use Daily</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EAttribute COMPOUND_ERROR_FUNCTION__USE_DAILY = eINSTANCE.getCompoundErrorFunction_UseDaily();
 
 	}
 
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/CompoundErrorFunction.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/CompoundErrorFunction.java
new file mode 100644
index 0000000..ff5abd8
--- /dev/null
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/CompoundErrorFunction.java
@@ -0,0 +1,92 @@
+/**
+ */
+package org.eclipse.stem.analysis;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Compound Error Function</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ *   <li>{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDeaths <em>Use Deaths</em>}</li>
+ *   <li>{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseCumSum <em>Use Cum Sum</em>}</li>
+ *   <li>{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDaily <em>Use Daily</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.stem.analysis.AnalysisPackage#getCompoundErrorFunction()
+ * @model
+ * @generated
+ */
+@SuppressWarnings("all")
+public interface CompoundErrorFunction extends ErrorFunction {
+	/**
+	 * Returns the value of the '<em><b>Use Deaths</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Use Deaths</em>' attribute.
+	 * @see #setUseDeaths(boolean)
+	 * @see org.eclipse.stem.analysis.AnalysisPackage#getCompoundErrorFunction_UseDeaths()
+	 * @model
+	 * @generated
+	 */
+	boolean isUseDeaths();
+
+	/**
+	 * Sets the value of the '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDeaths <em>Use Deaths</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Use Deaths</em>' attribute.
+	 * @see #isUseDeaths()
+	 * @generated
+	 */
+	void setUseDeaths(boolean value);
+
+	/**
+	 * Returns the value of the '<em><b>Use Cum Sum</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Use Cum Sum</em>' attribute.
+	 * @see #setUseCumSum(boolean)
+	 * @see org.eclipse.stem.analysis.AnalysisPackage#getCompoundErrorFunction_UseCumSum()
+	 * @model
+	 * @generated
+	 */
+	boolean isUseCumSum();
+
+	/**
+	 * Sets the value of the '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseCumSum <em>Use Cum Sum</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Use Cum Sum</em>' attribute.
+	 * @see #isUseCumSum()
+	 * @generated
+	 */
+	void setUseCumSum(boolean value);
+
+	/**
+	 * Returns the value of the '<em><b>Use Daily</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Use Daily</em>' attribute.
+	 * @see #setUseDaily(boolean)
+	 * @see org.eclipse.stem.analysis.AnalysisPackage#getCompoundErrorFunction_UseDaily()
+	 * @model
+	 * @generated
+	 */
+	boolean isUseDaily();
+
+	/**
+	 * Sets the value of the '{@link org.eclipse.stem.analysis.CompoundErrorFunction#isUseDaily <em>Use Daily</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Use Daily</em>' attribute.
+	 * @see #isUseDaily()
+	 * @generated
+	 */
+	void setUseDaily(boolean value);
+
+} // CompoundErrorFunction
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/ErrorResult.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/ErrorResult.java
index 691990f..8c68100 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/ErrorResult.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/ErrorResult.java
@@ -23,6 +23,7 @@
  *
  * <p>
  * The following features are supported:
+ * </p>
  * <ul>
  *   <li>{@link org.eclipse.stem.analysis.ErrorResult#getErrorByTimeStep <em>Error By Time Step</em>}</li>
  *   <li>{@link org.eclipse.stem.analysis.ErrorResult#getError <em>Error</em>}</li>
@@ -30,7 +31,6 @@
  *   <li>{@link org.eclipse.stem.analysis.ErrorResult#getModelByTime <em>Model By Time</em>}</li>
  *   <li>{@link org.eclipse.stem.analysis.ErrorResult#getValidationError <em>Validation Error</em>}</li>
  * </ul>
- * </p>
  *
  * @see org.eclipse.stem.analysis.AnalysisPackage#getErrorResult()
  * @model
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisFactoryImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisFactoryImpl.java
index 06d053f..a621a10 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisFactoryImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisFactoryImpl.java
@@ -18,6 +18,7 @@
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.impl.EFactoryImpl;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.stem.analysis.*;
 import org.eclipse.stem.analysis.AnalysisFactory;
 import org.eclipse.stem.analysis.AnalysisPackage;
 import org.eclipse.stem.analysis.ErrorFunction;
@@ -41,7 +42,7 @@
 	 */
 	public static AnalysisFactory init() {
 		try {
-			AnalysisFactory theAnalysisFactory = (AnalysisFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/stem/analysis.ecore"); 
+			AnalysisFactory theAnalysisFactory = (AnalysisFactory)EPackage.Registry.INSTANCE.getEFactory(AnalysisPackage.eNS_URI);
 			if (theAnalysisFactory != null) {
 				return theAnalysisFactory;
 			}
@@ -75,6 +76,7 @@
 			case AnalysisPackage.REFERENCE_SCENARIO_DATA_MAP: return createReferenceScenarioDataMap();
 			case AnalysisPackage.SIMPLE_ERROR_FUNCTION: return createSimpleErrorFunction();
 			case AnalysisPackage.ERROR_RESULT: return createErrorResult();
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION: return createCompoundErrorFunction();
 			default:
 				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
 		}
@@ -135,6 +137,16 @@
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
+	public CompoundErrorFunction createCompoundErrorFunction() {
+		CompoundErrorFunctionImpl compoundErrorFunction = new CompoundErrorFunctionImpl();
+		return compoundErrorFunction;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
 	public AnalysisPackage getAnalysisPackage() {
 		return (AnalysisPackage)getEPackage();
 	}
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisPackageImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisPackageImpl.java
index 6009ec4..85475ff 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisPackageImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/AnalysisPackageImpl.java
@@ -21,6 +21,7 @@
 import org.eclipse.emf.ecore.impl.EPackageImpl;
 import org.eclipse.stem.analysis.AnalysisFactory;
 import org.eclipse.stem.analysis.AnalysisPackage;
+import org.eclipse.stem.analysis.CompoundErrorFunction;
 import org.eclipse.stem.analysis.ErrorFunction;
 import org.eclipse.stem.analysis.ErrorResult;
 import org.eclipse.stem.analysis.ReferenceScenarioDataMap;
@@ -66,6 +67,12 @@
 	 */
 	private EClass errorResultEClass = null;
 	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	private EClass compoundErrorFunctionEClass = null;
+	/**
 	 * Creates an instance of the model <b>Package</b>, registered with
 	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
 	 * package URI value.
@@ -93,7 +100,7 @@
 
 	/**
 	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
-	 * 
+	 *
 	 * <p>This method is used to initialize {@link AnalysisPackage#eINSTANCE} when that field is accessed.
 	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 	 * <!-- begin-user-doc -->
@@ -107,7 +114,8 @@
 		if (isInited) return (AnalysisPackage)EPackage.Registry.INSTANCE.getEPackage(AnalysisPackage.eNS_URI);
 
 		// Obtain or create and register package
-		AnalysisPackageImpl theAnalysisPackage = (AnalysisPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof AnalysisPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new AnalysisPackageImpl());
+		Object registeredAnalysisPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
+		AnalysisPackageImpl theAnalysisPackage = registeredAnalysisPackage instanceof AnalysisPackageImpl ? (AnalysisPackageImpl)registeredAnalysisPackage : new AnalysisPackageImpl();
 
 		isInited = true;
 
@@ -120,7 +128,6 @@
 		// Mark meta-data to indicate it can't be changed
 		theAnalysisPackage.freeze();
 
-  
 		// Update the registry and return the package
 		EPackage.Registry.INSTANCE.put(AnalysisPackage.eNS_URI, theAnalysisPackage);
 		return theAnalysisPackage;
@@ -239,6 +246,42 @@
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
+	public EClass getCompoundErrorFunction() {
+		return compoundErrorFunctionEClass;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EAttribute getCompoundErrorFunction_UseDeaths() {
+		return (EAttribute)compoundErrorFunctionEClass.getEStructuralFeatures().get(0);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EAttribute getCompoundErrorFunction_UseCumSum() {
+		return (EAttribute)compoundErrorFunctionEClass.getEStructuralFeatures().get(1);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EAttribute getCompoundErrorFunction_UseDaily() {
+		return (EAttribute)compoundErrorFunctionEClass.getEStructuralFeatures().get(2);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
 	public AnalysisFactory getAnalysisFactory() {
 		return (AnalysisFactory)getEFactoryInstance();
 	}
@@ -278,6 +321,11 @@
 		createEAttribute(errorResultEClass, ERROR_RESULT__REFERENCE_BY_TIME);
 		createEAttribute(errorResultEClass, ERROR_RESULT__MODEL_BY_TIME);
 		createEAttribute(errorResultEClass, ERROR_RESULT__VALIDATION_ERROR);
+
+		compoundErrorFunctionEClass = createEClass(COMPOUND_ERROR_FUNCTION);
+		createEAttribute(compoundErrorFunctionEClass, COMPOUND_ERROR_FUNCTION__USE_DEATHS);
+		createEAttribute(compoundErrorFunctionEClass, COMPOUND_ERROR_FUNCTION__USE_CUM_SUM);
+		createEAttribute(compoundErrorFunctionEClass, COMPOUND_ERROR_FUNCTION__USE_DAILY);
 	}
 
 	/**
@@ -310,6 +358,7 @@
 		// Add supertypes to classes
 		thresholdErrorFunctionEClass.getESuperTypes().add(this.getErrorFunction());
 		simpleErrorFunctionEClass.getESuperTypes().add(this.getErrorFunction());
+		compoundErrorFunctionEClass.getESuperTypes().add(this.getErrorFunction());
 
 		// Initialize classes and features; add operations and parameters
 		initEClass(errorFunctionEClass, ErrorFunction.class, "ErrorFunction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -342,6 +391,11 @@
 		initEAttribute(getErrorResult_ModelByTime(), g1, "modelByTime", null, 0, 1, ErrorResult.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEAttribute(getErrorResult_ValidationError(), ecorePackage.getEDouble(), "validationError", null, 0, 1, ErrorResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
+		initEClass(compoundErrorFunctionEClass, CompoundErrorFunction.class, "CompoundErrorFunction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+		initEAttribute(getCompoundErrorFunction_UseDeaths(), ecorePackage.getEBoolean(), "useDeaths", null, 0, 1, CompoundErrorFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEAttribute(getCompoundErrorFunction_UseCumSum(), ecorePackage.getEBoolean(), "useCumSum", null, 0, 1, CompoundErrorFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEAttribute(getCompoundErrorFunction_UseDaily(), ecorePackage.getEBoolean(), "useDaily", null, 0, 1, CompoundErrorFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
 		// Create resource
 		createResource(eNS_URI);
 	}
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/CompoundErrorFunctionImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/CompoundErrorFunctionImpl.java
new file mode 100644
index 0000000..9405234
--- /dev/null
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/CompoundErrorFunctionImpl.java
@@ -0,0 +1,737 @@
+/**
+ */
+package org.eclipse.stem.analysis.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.stem.analysis.AnalysisFactory;
+import org.eclipse.stem.analysis.AnalysisPackage;
+import org.eclipse.stem.analysis.CompoundErrorFunction;
+import org.eclipse.stem.analysis.ErrorResult;
+import org.eclipse.stem.analysis.ReferenceScenarioDataMap;
+import org.eclipse.stem.analysis.impl.ReferenceScenarioDataMapImpl.ReferenceScenarioDataInstance;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Compound Error Function</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ *   <li>{@link org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl#isUseDeaths <em>Use Deaths</em>}</li>
+ *   <li>{@link org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl#isUseCumSum <em>Use Cum Sum</em>}</li>
+ *   <li>{@link org.eclipse.stem.analysis.impl.CompoundErrorFunctionImpl#isUseDaily <em>Use Daily</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class CompoundErrorFunctionImpl extends ErrorFunctionImpl implements CompoundErrorFunction {
+	/**
+	 * The default value of the '{@link #isUseDeaths() <em>Use Deaths</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseDeaths()
+	 * @generated NOT
+	 * @ordered
+	 */
+	protected static final boolean USE_DEATHS_EDEFAULT = true;
+
+	/**
+	 * The cached value of the '{@link #isUseDeaths() <em>Use Deaths</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseDeaths()
+	 * @generated
+	 * @ordered
+	 */
+	protected boolean useDeaths = USE_DEATHS_EDEFAULT;
+
+	/**
+	 * The default value of the '{@link #isUseCumSum() <em>Use Cum Sum</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseCumSum()
+	 * @generated NOT
+	 * @ordered
+	 */
+	protected static final boolean USE_CUM_SUM_EDEFAULT = true;
+
+	/**
+	 * The cached value of the '{@link #isUseCumSum() <em>Use Cum Sum</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseCumSum()
+	 * @generated
+	 * @ordered
+	 */
+	protected boolean useCumSum = USE_CUM_SUM_EDEFAULT;
+
+	/**
+	 * The default value of the '{@link #isUseDaily() <em>Use Daily</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseDaily()
+	 * @generated NOT
+	 * @ordered
+	 */
+	protected static final boolean USE_DAILY_EDEFAULT = true;
+
+	/**
+	 * The cached value of the '{@link #isUseDaily() <em>Use Daily</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #isUseDaily()
+	 * @generated
+	 * @ordered
+	 */
+	protected boolean useDaily = USE_DAILY_EDEFAULT;
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated NOT
+	 */
+	public CompoundErrorFunctionImpl() {
+		super();
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EClass eStaticClass() {
+		return AnalysisPackage.Literals.COMPOUND_ERROR_FUNCTION;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public boolean isUseDeaths() {
+		return useDeaths;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setUseDeaths(boolean newUseDeaths) {
+		boolean oldUseDeaths = useDeaths;
+		useDeaths = newUseDeaths;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DEATHS, oldUseDeaths, useDeaths));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public boolean isUseCumSum() {
+		return useCumSum;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setUseCumSum(boolean newUseCumSum) {
+		boolean oldUseCumSum = useCumSum;
+		useCumSum = newUseCumSum;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_CUM_SUM, oldUseCumSum, useCumSum));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public boolean isUseDaily() {
+		return useDaily;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setUseDaily(boolean newUseDaily) {
+		boolean oldUseDaily = useDaily;
+		useDaily = newUseDaily;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DAILY, oldUseDaily, useDaily));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object eGet(int featureID, boolean resolve, boolean coreType) {
+		switch (featureID) {
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DEATHS:
+				return isUseDeaths();
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_CUM_SUM:
+				return isUseCumSum();
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DAILY:
+				return isUseDaily();
+		}
+		return super.eGet(featureID, resolve, coreType);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eSet(int featureID, Object newValue) {
+		switch (featureID) {
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DEATHS:
+				setUseDeaths((Boolean)newValue);
+				return;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_CUM_SUM:
+				setUseCumSum((Boolean)newValue);
+				return;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DAILY:
+				setUseDaily((Boolean)newValue);
+				return;
+		}
+		super.eSet(featureID, newValue);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eUnset(int featureID) {
+		switch (featureID) {
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DEATHS:
+				setUseDeaths(USE_DEATHS_EDEFAULT);
+				return;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_CUM_SUM:
+				setUseCumSum(USE_CUM_SUM_EDEFAULT);
+				return;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DAILY:
+				setUseDaily(USE_DAILY_EDEFAULT);
+				return;
+		}
+		super.eUnset(featureID);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public boolean eIsSet(int featureID) {
+		switch (featureID) {
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DEATHS:
+				return useDeaths != USE_DEATHS_EDEFAULT;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_CUM_SUM:
+				return useCumSum != USE_CUM_SUM_EDEFAULT;
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION__USE_DAILY:
+				return useDaily != USE_DAILY_EDEFAULT;
+		}
+		return super.eIsSet(featureID);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public String toString() {
+		if (eIsProxy()) return super.toString();
+
+		StringBuilder result = new StringBuilder(super.toString());
+		result.append(" (useDeaths: ");
+		result.append(useDeaths);
+		result.append(", useCumSum: ");
+		result.append(useCumSum);
+		result.append(", useDaily: ");
+		result.append(useDaily);
+		result.append(')');
+		return result.toString();
+	}
+	
+	/**
+	 * input
+	 */
+	Map<String,List<Double>> commonDailyIncidenceLocationsMapA = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonDailyIncidenceLocationsMapB = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonCumIncidenceLocationsMapA = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonCumIncidenceLocationsMapB = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonCumDeathsLocationsMapA = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonCumDeathsLocationsMapB = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonPopulationLocationsA = new HashMap<String,List<Double>>();
+	Map<String,List<Double>> commonPopulationLocationsB = new HashMap<String,List<Double>>();
+
+	Map<String,Double> commonAvgPopulationLocationsA = new HashMap<String,Double>();
+	Map<String,Double> commonAvgPopulationLocationsB = new HashMap<String,Double>();
+	Map<String, Double> commonMaxLocationsA = new HashMap<String, Double>();
+	
+	/**
+	 * number common locations with nonzero Inf count at time t
+	 */
+	public double[] locationCount;
+	/**
+	 * The Result
+	 */
+	public double[] meanSqDiff;
+	/*
+	 * time
+	 */
+	public double[] time;
+	
+	protected AnalysisFactory aFactory = new AnalysisFactoryImpl();
+
+	// Set to true to weight the average by population size
+	private static boolean AGGREGATE_NRMSE = true; // True if aggregate signal for locations first, then calculate NRMSE. False if use NRMSE per location then average.
+	private static boolean WEIGHTED_AVERAGE = true; // Only used if AGGREGATE_NRMSE = false;
+	//private static boolean FIT_INCIDENCE = true;
+	private static boolean USE_THRESHOLD = false;
+	private static double THRESHOLD = 0.05;
+	
+	// The year to use to validate and hence exclude from the error calculation(for cross-validation methods)
+	// The first year is year 0. If no year should be excluded, set to -1
+	
+	int validationYear = -1;
+	
+	/**
+	 * calculate delta for a simple error function
+	 * 
+	 * 
+	 * @override
+	 */
+	
+	@Override
+	public ErrorResult calculateError(ReferenceScenarioDataMap reference, ReferenceScenarioDataMap data) {
+		final ReferenceScenarioDataMapImpl _ref = (ReferenceScenarioDataMapImpl)reference;
+		final ReferenceScenarioDataMapImpl _data = (ReferenceScenarioDataMapImpl)data;
+
+		// clear
+		time = null;
+		
+		Iterator<String> iteratorA = _ref.getLocations().iterator();
+		int maxTime = -1;
+		while(iteratorA.hasNext()) {
+			String id = iteratorA.next();
+					
+			if(_data.containsLocation(id)) {
+				// get the lists of data only for those locations that are common to both maps						ReferenceScenarioDataInstance dataMapA = mapA.getLocation(id);
+				ReferenceScenarioDataInstance dataMapA = _ref.getLocation(id);
+				List<Double> refDailyIncidenceList = null;
+				
+				refDailyIncidenceList = getData(referenceDataCompartment,dataMapA);
+				//Added new
+				List<Double> refCumDailyIncidenceList = getCumData(comparisonCompartment,dataMapA);
+				List<Double> refCumDailyDeathsList = null;
+				if(isUseDeaths()) {
+				refCumDailyDeathsList = getDeaths(dataMapA);
+				}
+				
+				List<Double> refPopulationList = getPopulation(dataMapA);
+				commonDailyIncidenceLocationsMapA.put(id,refDailyIncidenceList);
+				commonCumIncidenceLocationsMapA.put(id,refCumDailyIncidenceList);
+				if(isUseDeaths()) {
+					commonCumDeathsLocationsMapA.put(id,refCumDailyDeathsList);
+				}
+				commonPopulationLocationsA.put(id, refPopulationList);							
+							
+				// Map B
+				ReferenceScenarioDataInstance dataMapB = _data.getLocation(id);
+				List<Double> predDailyIncidenceList = null;
+				
+				predDailyIncidenceList = getData(comparisonCompartment,dataMapB);
+				
+				//Added new
+				List<Double> predCumDailyIncidenceList = getCumData(comparisonCompartment,dataMapB);
+				List<Double> predCumDailyDeathsList = null;
+				if(isUseDeaths()) {
+				 predCumDailyDeathsList= getDeaths(dataMapB);
+				}
+				
+				List<Double> predPopulationList = getPopulation(dataMapB);
+				commonDailyIncidenceLocationsMapB.put(id,predDailyIncidenceList);
+				commonCumIncidenceLocationsMapB.put(id,predCumDailyIncidenceList);
+				if(isUseDeaths()) {
+				commonCumDeathsLocationsMapB.put(id,predCumDailyDeathsList);
+				}
+				commonPopulationLocationsB.put(id, predPopulationList);
+				
+				// init the array size
+				if (maxTime == -1) maxTime = refDailyIncidenceList.size();
+						
+				// dimension the arrays to the length of the SMALLEST array for which we have data
+				if(maxTime >= predDailyIncidenceList.size() ) maxTime = predDailyIncidenceList.size();
+				if(maxTime >= refDailyIncidenceList.size() ) maxTime = refDailyIncidenceList.size();
+			}// if
+		}// while
+		
+		
+		if(maxTime<=0) maxTime = 0;
+		if(time==null) {
+			time = new double[maxTime];
+			meanSqDiff = new double[maxTime];
+			locationCount = new double[maxTime];
+			for(int i = 0; i < maxTime; i ++) {
+				time[i] = i;
+				meanSqDiff[i] = 0.0;
+				locationCount[i] = 0.0;
+			}
+		}
+		
+		//call the function to get the error for daily incidence,cumulative and deaths
+		
+	    //formerly called just list
+		BasicEList<Double> errorListDailyIncidence = new BasicEList<Double>();
+		BasicEList<Double> errorListCumIncidence = new BasicEList<Double>();
+		BasicEList<Double> errorListCumDeaths = new BasicEList<Double>();
+		
+		double[] errorsDailyIncidence = null, errorsCumIncidence = null,errorsCumDeath = null;
+		if(isUseDaily()) {
+		errorsDailyIncidence = getSpecificErrors(commonDailyIncidenceLocationsMapA,commonDailyIncidenceLocationsMapB,errorListDailyIncidence);
+		}
+		if(isUseCumSum()) {
+		errorsCumIncidence = getSpecificErrors(commonCumIncidenceLocationsMapA,commonCumIncidenceLocationsMapB,errorListCumIncidence);
+		}
+		if(isUseDeaths()) {
+		errorsCumDeath = getSpecificErrors(commonCumDeathsLocationsMapA,commonCumDeathsLocationsMapB,errorListCumDeaths);
+		}
+		// Now figure out the actual error
+		BasicEList<Double>list = takeAverage(errorListDailyIncidence,errorListCumIncidence,errorListCumDeaths);
+		double dailyIncidenceFinalError = 0,cumIncidenceFinalError=0,cumDeathFinalError=0;
+		double dailyIncidenceVError = 0,cumIncidenceVError=0,cumDeathVError=0;
+		if(errorsDailyIncidence!=null) {
+			dailyIncidenceFinalError = errorsDailyIncidence[0];
+			dailyIncidenceVError = errorsDailyIncidence[1];
+		}
+		if(errorsCumIncidence!=null) {
+			cumIncidenceFinalError = errorsCumIncidence[0];
+			cumIncidenceVError = errorsCumIncidence[1];
+		}
+
+		if(errorsCumDeath!=null) {
+			cumDeathFinalError = errorsCumDeath[0];
+			cumDeathVError = errorsCumDeath[1];
+		}
+		double finalerror = takeAverage(dailyIncidenceFinalError,cumIncidenceFinalError,cumDeathFinalError);
+		double verror = takeAverage(dailyIncidenceVError,cumIncidenceVError,cumDeathVError);
+		
+		
+		ErrorResult resultobj = aFactory.createErrorResult();
+		resultobj.setErrorByTimeStep(list);
+		resultobj.setError(finalerror);
+		resultobj.setValidationError(verror);
+		
+		EList<Double>refByTime = new BasicEList<Double>();
+		EList<Double>dataByTime = new BasicEList<Double>();
+		
+		// Set the reference and model by time
+		for(int icount=0;icount<time.length;++icount) {
+			refByTime.add(0.0);dataByTime.add(0.0);}
+		for(String loc:commonDailyIncidenceLocationsMapA.keySet()) {
+		 	for(int icount =0; icount < time.length; icount ++) {
+				List<Double> dataAI = commonDailyIncidenceLocationsMapA.get(loc);
+				List<Double> dataBI = commonDailyIncidenceLocationsMapB.get(loc);
+												
+				double iA = dataAI.get(icount).doubleValue();
+				double iB = dataBI.get(icount).doubleValue();
+			
+				refByTime.set(icount, refByTime.get(icount)+iA);
+				dataByTime.set(icount, dataByTime.get(icount)+iB);
+			}
+		}
+		resultobj.setReferenceByTime(refByTime);
+		resultobj.setModelByTime(dataByTime);
+		return resultobj;	
+	}
+	
+	/***
+	 * Function that takes averages of the three double values
+	 * @param error1
+	 * @param error2
+	 * @param error3
+	 * @return
+	 */
+	private double takeAverage(double error1, double error2, double error3) {
+		
+		int counter=0;
+		
+		if(isUseCumSum()) {
+			counter++;
+		}
+		if(isUseDaily()) {
+			counter++;
+		}
+		if(isUseDeaths()) {
+			counter++;
+		}
+		
+		return (error1+error2+error3)/counter;
+	}
+
+	/***
+	 * Function that takes average of the individual values across the three list
+	 * @param errorListDailyIncidence
+	 * @param errorListCumIncidence
+	 * @param errorListCumDeaths
+	 * @return
+	 */
+	private BasicEList<Double> takeAverage(BasicEList<Double> errorListDailyIncidence,
+			BasicEList<Double> errorListCumIncidence, BasicEList<Double> errorListCumDeaths) {
+		int counter=0;
+		int dailyIncidenceSize =-1;
+		int cumIncidenceSize =-1;
+		int cumDeathsSize =-1;
+		int totalSize=-1;
+
+		
+		if(isUseCumSum()) {
+			counter++;
+			cumIncidenceSize = errorListCumIncidence.size();
+		}
+		if(isUseDaily()) {
+			counter++;
+			dailyIncidenceSize = errorListDailyIncidence.size();
+			
+		}
+		if(isUseDeaths()) {
+			counter++;
+			cumDeathsSize = errorListCumDeaths.size();
+		}
+		
+		if(dailyIncidenceSize!=-1) {
+			totalSize = dailyIncidenceSize;
+		}
+		if (cumIncidenceSize!=-1) {
+			if(totalSize==-1) {
+			totalSize  = cumIncidenceSize;
+			}else {
+				if(totalSize!=cumIncidenceSize) {
+					//handle error if the lists are not of same size
+				}
+			}
+		}
+		
+		if (cumDeathsSize!=-1) {
+			if(totalSize==-1) {
+				totalSize  = cumDeathsSize;
+			}else {
+				if(totalSize!=cumDeathsSize) {
+						//handle error if the lists are not of same size
+				}
+			}
+		}
+		
+		BasicEList<Double> avgList=new BasicEList<Double>(Collections.nCopies(totalSize, 0.0));
+		
+		if(isUseCumSum()) {
+			avgList = sumTwoLists(avgList,errorListCumIncidence);
+			
+		}
+		if(isUseDaily()) {
+			avgList = sumTwoLists(avgList,errorListDailyIncidence);
+		}
+		if(isUseDeaths()) {
+			avgList = sumTwoLists(avgList,errorListCumDeaths);
+		}
+		for(int i=0;i<totalSize;i++) {
+			avgList.set(i, avgList.get(i)/counter);
+		}
+		
+		
+		return avgList;
+		
+	}
+
+	private BasicEList<Double> sumTwoLists(BasicEList<Double> avgList, BasicEList<Double> errorList) {
+		for(int i=0;i<avgList.size();i++) {
+			avgList.set(i, avgList.get(i)+ errorList.get(i));
+		}
+		return avgList;
+	}
+
+	public double[] getSpecificErrors(Map<String,List<Double>>commonDailyIncidenceLocationsMapA,Map<String,List<Double>>commonDailyIncidenceLocationsMapB,BasicEList<Double> list) {
+		double[]errors = new double[2];//contains error and verror
+		
+		double [] Xref = new double[time.length];
+		double [] Xdata = new double[time.length];
+		
+		double finalerror = 0.0;
+	    double verror = 0.0;
+	
+		for(int i=0;i<time.length;++i)list.add(0.0);
+		
+		// Get the average population for each location
+		for(String loc:commonPopulationLocationsA.keySet()) {
+			List<Double>ld = commonPopulationLocationsA.get(loc);
+			double sum = 0;for(double d:ld)sum+=d;
+			sum /= (double)ld.size();
+			commonAvgPopulationLocationsA.put(loc, sum);
+		}		
+
+		// Get the average population for each location
+		for(String loc:commonPopulationLocationsB.keySet()) {
+			List<Double>ld = commonPopulationLocationsB.get(loc);
+			double sum = 0;for(double d:ld)sum+=d;
+			sum /= (double)ld.size();
+			commonAvgPopulationLocationsB.put(loc, sum);
+		}		
+
+		// Get the maximum value for the A series (reference)
+		for(String loc:commonPopulationLocationsA.keySet()) {
+			List<Double>ld = commonDailyIncidenceLocationsMapA.get(loc);
+			double max = Double.MIN_VALUE;
+			for(double d:ld)if(d >max)max=d;
+			commonMaxLocationsA.put(loc, max);
+		}
+		
+		// Calculate the normalized root mean square error for each location, then
+		// divide by the number of locatins
+		
+		double weighted_denom = 0.0;
+		
+		if(!AGGREGATE_NRMSE) { // Use NRMSE per location first
+			for(String loc:commonDailyIncidenceLocationsMapA.keySet()) {
+				double maxRef = 0.0;
+				double minRef = Double.MAX_VALUE;
+				// Get the numbers at each time step for the location
+				for(int icount =0; icount < time.length; icount ++) {
+					List<Double> dataAI = commonDailyIncidenceLocationsMapA.get(loc);
+					List<Double> dataBI = commonDailyIncidenceLocationsMapB.get(loc);
+													
+					double iA = dataAI.get(icount).doubleValue();
+					double iB = dataBI.get(icount).doubleValue();
+				
+					Xref[icount]=iA;
+					Xdata[icount]=iB;
+				}
+			
+				double nominator = 0.0; 
+				double timesteps = 0;
+				for(int icount =0; icount < time.length; icount ++) {
+					if(Xref[icount]>maxRef)maxRef = Xref[icount];
+					if(Xref[icount]<minRef)minRef = Xref[icount];
+					
+					// If we use the threshold and both the reference and the model is less than
+					// the THRESHOLD*MAXref(loc) we don't measure the data point
+					
+					if(USE_THRESHOLD && (Xref[icount]<=THRESHOLD*commonMaxLocationsA.get(loc) &&
+							Xdata[icount]<=THRESHOLD*commonMaxLocationsA.get(loc))) continue;
+					
+					nominator = nominator + Math.pow(Xref[icount]-Xdata[icount], 2);
+					list.set(icount, list.get(icount)+Math.abs(Xref[icount]-Xdata[icount]));
+					++timesteps;
+				}
+				double error = Double.MAX_VALUE;
+			    if(timesteps > 0 && maxRef-minRef > 0.0) {
+			    	error = Math.sqrt(nominator/timesteps);
+			    	error = error / (maxRef-minRef);
+			    	if(WEIGHTED_AVERAGE) finalerror += commonAvgPopulationLocationsA.get(loc) * error;
+			    	else finalerror += error;
+			    	if(WEIGHTED_AVERAGE) weighted_denom += commonAvgPopulationLocationsA.get(loc);
+			    	else weighted_denom += 1.0;
+			    }
+			
+			}
+			
+			
+		
+			// Divide the error by the number of locations
+			finalerror /= weighted_denom; 
+		} else { // Aggregate signal, then calculate NRMSE 
+			for(int icount =0; icount < time.length; icount ++) {
+				for(String loc:commonDailyIncidenceLocationsMapA.keySet()) {
+					List<Double> dataAI = commonDailyIncidenceLocationsMapA.get(loc);
+					List<Double> dataBI = commonDailyIncidenceLocationsMapB.get(loc);
+													
+					double iA = dataAI.get(icount).doubleValue();
+					double iB = dataBI.get(icount).doubleValue();
+				
+					Xref[icount]+=iA;
+					Xdata[icount]+=iB;
+				}
+			}
+			
+			double maxRef = Double.MIN_VALUE;
+			double minRef = Double.MAX_VALUE;
+			double maxValidationRef = Double.MIN_VALUE;
+			double minValidationRef = Double.MAX_VALUE;
+			
+			for(int icount =0; icount < time.length; icount ++) {
+				if(icount >= validationYear*365.25 && icount <= (validationYear+1)*365.25) {
+					if(Xref[icount]>maxValidationRef)maxValidationRef = Xref[icount];
+					if(Xref[icount]<minValidationRef)minValidationRef = Xref[icount];
+					continue;
+				}
+				if(Xref[icount]>maxRef)maxRef = Xref[icount];
+				if(Xref[icount]<minRef)minRef = Xref[icount];
+			}
+			double nominator = 0.0, vnominator = 0.0;
+			double timesteps = 0.0, vtimesteps = 0.0;
+			for(int icount =0; icount < time.length; icount ++) {
+				
+				// Calculate validation error then skip
+				if(icount >= validationYear*365.25 && icount <= (validationYear+1)*365.25) {
+					if(USE_THRESHOLD && (Xref[icount]<=THRESHOLD*maxValidationRef &&
+							Xdata[icount]<=THRESHOLD*maxValidationRef)) continue;
+					
+					vnominator = vnominator + Math.pow(Xref[icount]-Xdata[icount], 2);
+					list.set(icount, new Double(0)); // Set to 0 for validation data points
+					++vtimesteps;
+					continue;
+				}
+				// If we use the threshold and both the reference and the model is less than
+				// the THRESHOLD*MAXref(loc) we don't measure the data point
+				
+				if(USE_THRESHOLD && (Xref[icount]<=THRESHOLD*maxRef &&
+						Xdata[icount]<=THRESHOLD*maxRef)) continue;
+				
+				nominator = nominator + Math.pow(Xref[icount]-Xdata[icount], 2);
+				list.set(icount, Math.abs(Xref[icount]-Xdata[icount]));
+				++timesteps;
+			}
+			
+			double error = Double.MAX_VALUE;
+		    if(timesteps > 0 && maxRef-minRef > 0.0) {
+		    	error = Math.sqrt(nominator/timesteps);
+		    	finalerror = error / (maxRef-minRef);
+		    }
+		    // Validation
+		    error = Double.MAX_VALUE;
+		    if(vtimesteps > 0 && maxValidationRef-minValidationRef > 0.0) {
+		    	error = Math.sqrt(vnominator/vtimesteps);
+		    	verror = error / (maxValidationRef-minValidationRef);
+		    }
+		} // else
+		
+		errors[0]=finalerror;
+		errors[1]=verror;
+		return errors;
+	}
+
+} //CompoundErrorFunctionImpl
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorFunctionImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorFunctionImpl.java
index bad1dd0..45ace99 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorFunctionImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorFunctionImpl.java
@@ -33,11 +33,11 @@
  * <!-- end-user-doc -->
  * <p>
  * The following features are implemented:
+ * </p>
  * <ul>
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorFunctionImpl#getReferenceDataCompartment <em>Reference Data Compartment</em>}</li>
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorFunctionImpl#getComparisonCompartment <em>Comparison Compartment</em>}</li>
  * </ul>
- * </p>
  *
  * @generated
  */
@@ -228,7 +228,7 @@
 	public String toString() {
 		if (eIsProxy()) return super.toString();
 
-		StringBuffer result = new StringBuffer(super.toString());
+		StringBuilder result = new StringBuilder(super.toString());
 		result.append(" (referenceDataCompartment: ");
 		result.append(referenceDataCompartment);
 		result.append(", comparisonCompartment: ");
@@ -292,6 +292,65 @@
 		return infectious;
 	}
 	
+	/**
+	 * From the dataMap extract a list of infectious
+	 * @param dataMap
+	 * @return list of infectious people
+	 */
+	public List<Double> getCumData(String state, ReferenceScenarioDataInstance dataMap) { 
+		// MUST exist
+		
+		List<String> incidenceList = dataMap.getData(state);
+		assert(incidenceList!=null);
+		
+		List<Double> infectious = new ArrayList<Double>();
+		for (int i = 0; i < incidenceList.size(); i ++) {
+			
+			double inf = (new Double(incidenceList.get(i))).doubleValue();
+			infectious.add(new Double(inf));
+		}
+		
+		List<Double>cumulative = dailyToCum(infectious);
+		return cumulative;
+	}
+	
+	/***
+	 * Getting cumulative values from the daily incidence data
+	 * @param dailyValues
+	 * @return list of daily cumulative sum
+	 */
+	private List<Double> dailyToCum(List<Double> dailyValues) {
+        List<Double>cumValues = new ArrayList<>();
+        for(int i=0;i<dailyValues.size();i++){
+            if(i==0){
+                cumValues.add(dailyValues.get(i));
+            }else{
+                cumValues.add(dailyValues.get(i)+cumValues.get(i-1));
+            }
+        }
+        return cumValues;
+    }
+	
+	/**
+	 * From the dataMap extract a list of death values
+	 * @param dataMap
+	 * @return list of cumulative death by day 
+	 */
+	public List<Double> getDeaths(ReferenceScenarioDataInstance dataMap) {
+		final String DISEASE_DEATHS = States.statesToFit[States.DISEASE_DEATHS];
+		// MUST exist
+		List<String> deathList = dataMap.getData(DISEASE_DEATHS);
+		//we standardize on disease deaths to be "Disease Deaths" as header of 
+		assert(deathList!=null);
+		
+		List<Double> deaths = new ArrayList<Double>();
+		for (int i = 0; i < deathList.size(); i ++) {
+			
+			double d = (new Double(deathList.get(i))).doubleValue();
+			deaths.add(new Double(d));
+		}
+		return deaths;
+	}
 	
 	/**
 	 * From the dataMap extract a list of population values
@@ -311,8 +370,8 @@
 		List<Double> populations = new ArrayList<Double>();
 		for (int i = 0; i < popList.size(); i ++) {
 			
-			double inf = (new Double(popList.get(i))).doubleValue();
-			populations.add(new Double(inf));
+			double p = (new Double(popList.get(i))).doubleValue();
+			populations.add(new Double(p));
 		}
 		return populations;
 	}
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorResultImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorResultImpl.java
index 1c5075c..0e2c200 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorResultImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ErrorResultImpl.java
@@ -28,6 +28,7 @@
  * <!-- end-user-doc -->
  * <p>
  * The following features are implemented:
+ * </p>
  * <ul>
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorResultImpl#getErrorByTimeStep <em>Error By Time Step</em>}</li>
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorResultImpl#getError <em>Error</em>}</li>
@@ -35,7 +36,6 @@
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorResultImpl#getModelByTime <em>Model By Time</em>}</li>
  *   <li>{@link org.eclipse.stem.analysis.impl.ErrorResultImpl#getValidationError <em>Validation Error</em>}</li>
  * </ul>
- * </p>
  *
  * @generated
  */
@@ -338,7 +338,7 @@
 	public String toString() {
 		if (eIsProxy()) return super.toString();
 
-		StringBuffer result = new StringBuffer(super.toString());
+		StringBuilder result = new StringBuilder(super.toString());
 		result.append(" (errorByTimeStep: ");
 		result.append(errorByTimeStep);
 		result.append(", error: ");
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ReferenceScenarioDataMapImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ReferenceScenarioDataMapImpl.java
index 073f848..1732158 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ReferenceScenarioDataMapImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ReferenceScenarioDataMapImpl.java
@@ -39,8 +39,6 @@
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Reference Scenario Data Map</b></em>'.
  * <!-- end-user-doc -->
- * <p>
- * </p>
  *
  * @generated
  */
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/SimpleErrorFunctionImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/SimpleErrorFunctionImpl.java
index ededc6c..60f5dd2 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/SimpleErrorFunctionImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/SimpleErrorFunctionImpl.java
@@ -32,8 +32,6 @@
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Simple Error Function</b></em>'.
  * <!-- end-user-doc -->
- * <p>
- * </p>
  *
  * @generated
  */
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ThresholdErrorFunctionImpl.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ThresholdErrorFunctionImpl.java
index 4e589eb..a263852 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ThresholdErrorFunctionImpl.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/impl/ThresholdErrorFunctionImpl.java
@@ -31,8 +31,6 @@
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Threshold Error Function</b></em>'.
  * <!-- end-user-doc -->
- * <p>
- * </p>
  *
  * @generated
  */
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisActionBarContributor.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisActionBarContributor.java
index c928a3b..833804e 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisActionBarContributor.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisActionBarContributor.java
@@ -169,6 +169,7 @@
 	 */
 	@Override
 	public void contributeToToolBar(IToolBarManager toolBarManager) {
+		super.contributeToToolBar(toolBarManager);
 		toolBarManager.add(new Separator("analysis-settings"));
 		toolBarManager.add(new Separator("analysis-additions"));
 	}
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisEditor.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisEditor.java
index 707ea8f..14b33e9 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisEditor.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/presentation/AnalysisEditor.java
@@ -81,6 +81,7 @@
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.ColumnWeightData;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -99,10 +100,12 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
 import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.events.ControlAdapter;
 import org.eclipse.swt.events.ControlEvent;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
@@ -185,7 +188,7 @@
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	protected PropertySheetPage propertySheetPage;
+	protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>();
 
 	/**
 	 * This is the viewer that shadows the selection in the content outline.
@@ -304,7 +307,7 @@
 					}
 				}
 				else if (p instanceof PropertySheet) {
-					if (((PropertySheet)p).getCurrentPage() == propertySheetPage) {
+					if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
 						getActionBarContributor().setActiveEditor(AnalysisEditor.this);
 						handleActivate();
 					}
@@ -375,6 +378,8 @@
 	 */
 	protected EContentAdapter problemIndicationAdapter = 
 		new EContentAdapter() {
+			protected boolean dispatching;
+
 			@Override
 			public void notifyChanged(Notification notification) {
 				if (notification.getNotifier() instanceof Resource) {
@@ -390,15 +395,7 @@
 							else {
 								resourceToDiagnosticMap.remove(resource);
 							}
-
-							if (updateProblemIndication) {
-								getSite().getShell().getDisplay().asyncExec
-									(new Runnable() {
-										 public void run() {
-											 updateProblemIndication();
-										 }
-									 });
-							}
+							dispatchUpdateProblemIndication();
 							break;
 						}
 					}
@@ -408,6 +405,19 @@
 				}
 			}
 
+			protected void dispatchUpdateProblemIndication() {
+				if (updateProblemIndication && !dispatching) {
+					dispatching = true;
+					getSite().getShell().getDisplay().asyncExec
+						(new Runnable() {
+							 public void run() {
+								 dispatching = false;
+								 updateProblemIndication();
+							 }
+						 });
+				}
+			}
+
 			@Override
 			protected void setTarget(Resource target) {
 				basicSetTarget(target);
@@ -416,6 +426,8 @@
 			@Override
 			protected void unsetTarget(Resource target) {
 				basicUnsetTarget(target);
+				resourceToDiagnosticMap.remove(target);
+				dispatchUpdateProblemIndication();
 			}
 		};
 
@@ -449,6 +461,7 @@
 										}
 									}
 								}
+								return false;
 							}
 
 							return true;
@@ -539,8 +552,9 @@
 	 */
 	protected void handleChangedResources() {
 		if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+			ResourceSet resourceSet = editingDomain.getResourceSet();
 			if (isDirty()) {
-				changedResources.addAll(editingDomain.getResourceSet().getResources());
+				changedResources.addAll(resourceSet.getResources());
 			}
 			editingDomain.getCommandStack().flush();
 
@@ -549,7 +563,7 @@
 				if (resource.isLoaded()) {
 					resource.unload();
 					try {
-						resource.load(Collections.EMPTY_MAP);
+						resource.load(resourceSet.getLoadOptions());
 					}
 					catch (IOException exception) {
 						if (!resourceToDiagnosticMap.containsKey(resource)) {
@@ -612,14 +626,11 @@
 			}
 
 			if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
-				markerHelper.deleteMarkers(editingDomain.getResourceSet());
-				if (diagnostic.getSeverity() != Diagnostic.OK) {
-					try {
-						markerHelper.createMarkers(diagnostic);
-					}
-					catch (CoreException exception) {
-						AnalysisEditPlugin.INSTANCE.log(exception);
-					}
+				try {
+					markerHelper.updateMarkers(diagnostic);
+				}
+				catch (CoreException exception) {
+					AnalysisEditPlugin.INSTANCE.log(exception);
 				}
 			}
 		}
@@ -685,8 +696,14 @@
 								  if (mostRecentCommand != null) {
 									  setSelectionToViewer(mostRecentCommand.getAffectedObjects());
 								  }
-								  if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
-									  propertySheetPage.refresh();
+								  for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
+									  PropertySheetPage propertySheetPage = i.next();
+									  if (propertySheetPage.getControl() == null || propertySheetPage.getControl().isDisposed()) {
+										  i.remove();
+									  }
+									  else {
+										  propertySheetPage.refresh();
+									  }
 								  }
 							  }
 						  });
@@ -892,7 +909,7 @@
 		getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
 
 		int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
-		Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
+		Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
 		viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
 		viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
 	}
@@ -904,7 +921,7 @@
 	 * @generated
 	 */
 	public void createModel() {
-		URI resourceURI = EditUIUtil.getURI(getEditorInput());
+		URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
 		Exception exception = null;
 		Resource resource = null;
 		try {
@@ -932,10 +949,11 @@
 	 * @generated
 	 */
 	public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
-		if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+		boolean hasErrors = !resource.getErrors().isEmpty();
+		if (hasErrors || !resource.getWarnings().isEmpty()) {
 			BasicDiagnostic basicDiagnostic =
 				new BasicDiagnostic
-					(Diagnostic.ERROR,
+					(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
 					 "org.eclipse.stem.analysis",
 					 0,
 					 getString("_UI_CreateModelError_message", resource.getURI()),
@@ -993,6 +1011,7 @@
 
 				selectionViewer = (TreeViewer)viewerPane.getViewer();
 				selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+				selectionViewer.setUseHashlookup(true);
 
 				selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
 				selectionViewer.setInput(editingDomain.getResourceSet());
@@ -1176,7 +1195,9 @@
 			getSite().getShell().getDisplay().asyncExec
 				(new Runnable() {
 					 public void run() {
-						 setActivePage(0);
+						 if (!getContainer().isDisposed()) {
+							 setActivePage(0);
+						 }
 					 }
 				 });
 		}
@@ -1216,9 +1237,9 @@
 		if (getPageCount() <= 1) {
 			setPageText(0, "");
 			if (getContainer() instanceof CTabFolder) {
-				((CTabFolder)getContainer()).setTabHeight(1);
 				Point point = getContainer().getSize();
-				getContainer().setSize(point.x, point.y + 6);
+				Rectangle clientArea = getContainer().getClientArea();
+				getContainer().setSize(point.x,  2 * point.y - clientArea.height - clientArea.y);
 			}
 		}
 	}
@@ -1234,9 +1255,9 @@
 		if (getPageCount() > 1) {
 			setPageText(0, getString("_UI_SelectionPage_label"));
 			if (getContainer() instanceof CTabFolder) {
-				((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
 				Point point = getContainer().getSize();
-				getContainer().setSize(point.x, point.y - 6);
+				Rectangle clientArea = getContainer().getClientArea();
+				getContainer().setSize(point.x, clientArea.height + clientArea.y);
 			}
 		}
 	}
@@ -1264,15 +1285,15 @@
 	 */
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	@Override
-	public Object getAdapter(Class key) {
+	public <T> T getAdapter(Class<T> key) {
 		if (key.equals(IContentOutlinePage.class)) {
-			return showOutlineView() ? getContentOutlinePage() : null;
+			return showOutlineView() ? key.cast(getContentOutlinePage()) : null;
 		}
 		else if (key.equals(IPropertySheetPage.class)) {
-			return getPropertySheetPage();
+			return key.cast(getPropertySheetPage());
 		}
 		else if (key.equals(IGotoMarker.class)) {
-			return this;
+			return key.cast(this);
 		}
 		else {
 			return super.getAdapter(key);
@@ -1298,6 +1319,7 @@
 
 					// Set up the tree viewer.
 					//
+					contentOutlineViewer.setUseHashlookup(true);
 					contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
 					contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
 					contentOutlineViewer.setInput(editingDomain.getResourceSet());
@@ -1350,23 +1372,22 @@
 	 * @generated
 	 */
 	public IPropertySheetPage getPropertySheetPage() {
-		if (propertySheetPage == null) {
-			propertySheetPage =
-				new ExtendedPropertySheetPage(editingDomain) {
-					@Override
-					public void setSelectionToViewer(List<?> selection) {
-						AnalysisEditor.this.setSelectionToViewer(selection);
-						AnalysisEditor.this.setFocus();
-					}
+		PropertySheetPage propertySheetPage =
+			new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null) {
+				@Override
+				public void setSelectionToViewer(List<?> selection) {
+					AnalysisEditor.this.setSelectionToViewer(selection);
+					AnalysisEditor.this.setFocus();
+				}
 
-					@Override
-					public void setActionBars(IActionBars actionBars) {
-						super.setActionBars(actionBars);
-						getActionBarContributor().shareGlobalActions(this, actionBars);
-					}
-				};
-			propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
-		}
+				@Override
+				public void setActionBars(IActionBars actionBars) {
+					super.setActionBars(actionBars);
+					getActionBarContributor().shareGlobalActions(this, actionBars);
+				}
+			};
+		propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+		propertySheetPages.add(propertySheetPage);
 
 		return propertySheetPage;
 	}
@@ -1433,6 +1454,7 @@
 		//
 		final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
 		saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+		saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
 
 		// Do the work within an operation because this is a long running activity that modifies the workbench.
 		//
@@ -1445,7 +1467,9 @@
 					// Save the resources to the file system.
 					//
 					boolean first = true;
-					for (Resource resource : editingDomain.getResourceSet().getResources()) {
+					List<Resource> resources = editingDomain.getResourceSet().getResources();
+					for (int i = 0; i < resources.size(); ++i) {
+						Resource resource = resources.get(i);
 						if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
 							try {
 								long timeStamp = resource.getTimeStamp();
@@ -1485,7 +1509,7 @@
 
 	/**
 	 * This returns whether something has been persisted to the URI of the specified resource.
-	 * The implementation uses the URI converter from the editor's resource set to try to open an input stream. 
+	 * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
@@ -1557,20 +1581,9 @@
 	 * @generated
 	 */
 	public void gotoMarker(IMarker marker) {
-		try {
-			if (marker.getType().equals(EValidator.MARKER)) {
-				String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
-				if (uriAttribute != null) {
-					URI uri = URI.createURI(uriAttribute);
-					EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
-					if (eObject != null) {
-					  setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
-					}
-				}
-			}
-		}
-		catch (CoreException exception) {
-			AnalysisEditPlugin.INSTANCE.log(exception);
+		List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker);
+		if (!targetObjects.isEmpty()) {
+			setSelectionToViewer(targetObjects);
 		}
 	}
 
@@ -1761,7 +1774,7 @@
 			getActionBarContributor().setActiveEditor(null);
 		}
 
-		if (propertySheetPage != null) {
+		for (PropertySheetPage propertySheetPage : propertySheetPages) {
 			propertySheetPage.dispose();
 		}
 
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/AnalysisItemProviderAdapterFactory.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/AnalysisItemProviderAdapterFactory.java
index 26e88c0..a34aced 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/AnalysisItemProviderAdapterFactory.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/AnalysisItemProviderAdapterFactory.java
@@ -195,6 +195,29 @@
 	}
 
 	/**
+	 * This keeps track of the one adapter used for all {@link org.eclipse.stem.analysis.CompoundErrorFunction} instances.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected CompoundErrorFunctionItemProvider compoundErrorFunctionItemProvider;
+
+	/**
+	 * This creates an adapter for a {@link org.eclipse.stem.analysis.CompoundErrorFunction}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Adapter createCompoundErrorFunctionAdapter() {
+		if (compoundErrorFunctionItemProvider == null) {
+			compoundErrorFunctionItemProvider = new CompoundErrorFunctionItemProvider(this);
+		}
+
+		return compoundErrorFunctionItemProvider;
+	}
+
+	/**
 	 * This returns the root adapter factory that contains this factory.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -298,6 +321,7 @@
 		if (referenceScenarioDataMapItemProvider != null) referenceScenarioDataMapItemProvider.dispose();
 		if (simpleErrorFunctionItemProvider != null) simpleErrorFunctionItemProvider.dispose();
 		if (errorResultItemProvider != null) errorResultItemProvider.dispose();
+		if (compoundErrorFunctionItemProvider != null) compoundErrorFunctionItemProvider.dispose();
 	}
 
 }
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ErrorResultItemProvider.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ErrorResultItemProvider.java
index dce227b..5d9ef17 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ErrorResultItemProvider.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ErrorResultItemProvider.java
@@ -205,7 +205,7 @@
 	 */
 	@Override
 	public String getText(Object object) {
-		EList<Double> labelValue = ((ErrorResult)object).getErrorByTimeStep();
+		EList labelValue = ((ErrorResult)object).getErrorByTimeStep();
 		String label = labelValue == null ? null : labelValue.toString();
 		return label == null || label.length() == 0 ?
 			getString("_UI_ErrorResult_type") :
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/SimpleErrorFunctionItemProvider.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/SimpleErrorFunctionItemProvider.java
index d477fb0..b6ce231 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/SimpleErrorFunctionItemProvider.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/SimpleErrorFunctionItemProvider.java
@@ -31,13 +31,7 @@
  * @generated
  */
 public class SimpleErrorFunctionItemProvider
-	extends ErrorFunctionItemProvider
-	implements
-		IEditingDomainItemProvider,
-		IStructuredItemContentProvider,
-		ITreeItemContentProvider,
-		IItemLabelProvider,
-		IItemPropertySource {
+	extends ErrorFunctionItemProvider {
 	/**
 	 * This constructs an instance from a factory and a notifier.
 	 * <!-- begin-user-doc -->
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ThresholdErrorFunctionItemProvider.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ThresholdErrorFunctionItemProvider.java
index 3ab19a9..d4d1150 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ThresholdErrorFunctionItemProvider.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/provider/ThresholdErrorFunctionItemProvider.java
@@ -32,13 +32,7 @@
  * @generated
  */
 public class ThresholdErrorFunctionItemProvider
-	extends ErrorFunctionItemProvider
-	implements
-		IEditingDomainItemProvider,
-		IStructuredItemContentProvider,
-		ITreeItemContentProvider,
-		IItemLabelProvider,
-		IItemPropertySource {
+	extends ErrorFunctionItemProvider {
 	/**
 	 * This constructs an instance from a factory and a notifier.
 	 * <!-- begin-user-doc -->
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisAdapterFactory.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisAdapterFactory.java
index 8e42bc7..3be5b65 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisAdapterFactory.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisAdapterFactory.java
@@ -17,6 +17,7 @@
 import org.eclipse.emf.common.notify.Notifier;
 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
 import org.eclipse.emf.ecore.EObject;
+import org.eclipse.stem.analysis.*;
 import org.eclipse.stem.analysis.AnalysisPackage;
 import org.eclipse.stem.analysis.ErrorFunction;
 import org.eclipse.stem.analysis.ErrorResult;
@@ -101,6 +102,10 @@
 				return createErrorResultAdapter();
 			}
 			@Override
+			public Adapter caseCompoundErrorFunction(CompoundErrorFunction object) {
+				return createCompoundErrorFunctionAdapter();
+			}
+			@Override
 			public Adapter defaultCase(EObject object) {
 				return createEObjectAdapter();
 			}
@@ -191,6 +196,20 @@
 	}
 
 	/**
+	 * Creates a new adapter for an object of class '{@link org.eclipse.stem.analysis.CompoundErrorFunction <em>Compound Error Function</em>}'.
+	 * <!-- begin-user-doc -->
+	 * This default implementation returns null so that we can easily ignore cases;
+	 * it's useful to ignore a case when inheritance will catch all the cases anyway.
+	 * <!-- end-user-doc -->
+	 * @return the new adapter.
+	 * @see org.eclipse.stem.analysis.CompoundErrorFunction
+	 * @generated
+	 */
+	public Adapter createCompoundErrorFunctionAdapter() {
+		return null;
+	}
+
+	/**
 	 * Creates a new adapter for the default case.
 	 * <!-- begin-user-doc -->
 	 * This default implementation returns null.
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisSwitch.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisSwitch.java
index a25d979..257df82 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisSwitch.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis/src/org/eclipse/stem/analysis/util/AnalysisSwitch.java
@@ -16,6 +16,7 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.stem.analysis.*;
 import org.eclipse.stem.analysis.AnalysisPackage;
 import org.eclipse.stem.analysis.ErrorFunction;
 import org.eclipse.stem.analysis.ErrorResult;
@@ -62,7 +63,7 @@
 	 * Checks whether this is a switch for the given package.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @parameter ePackage the package in question.
+	 * @param ePackage the package in question.
 	 * @return whether this is a switch for the given package.
 	 * @generated
 	 */
@@ -113,6 +114,13 @@
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
+			case AnalysisPackage.COMPOUND_ERROR_FUNCTION: {
+				CompoundErrorFunction compoundErrorFunction = (CompoundErrorFunction)theEObject;
+				T result = caseCompoundErrorFunction(compoundErrorFunction);
+				if (result == null) result = caseErrorFunction(compoundErrorFunction);
+				if (result == null) result = defaultCase(theEObject);
+				return result;
+			}
 			default: return defaultCase(theEObject);
 		}
 	}
@@ -193,6 +201,21 @@
 	}
 
 	/**
+	 * Returns the result of interpreting the object as an instance of '<em>Compound Error Function</em>'.
+	 * <!-- begin-user-doc -->
+	 * This implementation returns null;
+	 * returning a non-null result will terminate the switch.
+	 * <!-- end-user-doc -->
+	 * @param object the target of the switch.
+	 * @return the result of interpreting the object as an instance of '<em>Compound Error Function</em>'.
+	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+	 * @generated
+	 */
+	public T caseCompoundErrorFunction(CompoundErrorFunction object) {
+		return null;
+	}
+
+	/**
 	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
 	 * <!-- begin-user-doc -->
 	 * This implementation returns null;
diff --git a/org.eclipse.stem/releng/org.eclipse.stem.tycho.product/pom.xml b/org.eclipse.stem/releng/org.eclipse.stem.tycho.product/pom.xml
index 0af4cfe..9507cf3 100755
--- a/org.eclipse.stem/releng/org.eclipse.stem.tycho.product/pom.xml
+++ b/org.eclipse.stem/releng/org.eclipse.stem.tycho.product/pom.xml
@@ -8,7 +8,7 @@
 
 	<groupId>org.eclipse.stem.tycho</groupId>
 	<artifactId>org.eclipse.stem.tycho.product</artifactId>
-	<packaging>eclipse-repository</packaging>
+	<packaging>eclipse-update-site</packaging>
 	<version>1.0.0-SNAPSHOT</version>
 
 	<build>