Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 14390)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 14391)
@@ -114,22 +114,10 @@
       alglib.lrunpack(lm, out coefficients, out nFeatures);
 
-
-      ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
-      ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
-      tree.Root.AddSubtree(startNode);
-      ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode();
-      startNode.AddSubtree(addition);
-
-      for (int i = 0; i < timeOffset; i++) {
-        LaggedVariableTreeNode node = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode();
-        node.VariableName = targetVariable;
-        node.Weight = coefficients[i];
-        node.Lag = (i + 1) * -1;
-        addition.AddSubtree(node);
-      }
-
-      ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
-      cNode.Value = coefficients[coefficients.Length - 1];
-      addition.AddSubtree(cNode);
+      var tree = LinearModelToTreeConverter.CreateTree(
+        variableNames: Enumerable.Repeat(problemData.TargetVariable, nFeatures).ToArray(),
+        lags: Enumerable.Range(0, timeOffset).Select(i => (i + 1) * -1).ToArray(),
+        coefficients: coefficients.Take(nFeatures).ToArray(),
+        @const: coefficients[nFeatures]
+        );
 
       var interpreter = new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(problemData.TargetVariable);
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/Convert.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/Convert.cs	(revision 14390)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/Convert.cs	(revision 14391)
@@ -48,4 +48,8 @@
       return LinearModelToTreeConverter.CreateTree(variableNames, coefficients, @const);
     }
+    public static ISymbolicExpressionTree CreateLinearModel(string[] variableNames, int[] lags, double[] coefficients,
+      double @const = 0) {
+      return LinearModelToTreeConverter.CreateTree(variableNames, coefficients, @const);
+    }
   }
 }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs	(revision 14390)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs	(revision 14391)
@@ -28,7 +28,14 @@
     public static ISymbolicExpressionTree CreateTree(string[] variableNames, double[] coefficients,
       double @const = 0) {
+      return CreateTree(variableNames, new int[variableNames.Length], coefficients, @const);
+    }
+
+    public static ISymbolicExpressionTree CreateTree(string[] variableNames, int[] lags, double[] coefficients,
+      double @const = 0) {
       if (variableNames.Length == 0 ||
-        variableNames.Length != coefficients.Length)
-        throw new ArgumentException("The length of the variable names and coefficients vectors must match");
+        variableNames.Length != coefficients.Length ||
+        variableNames.Length != lags.Length)
+        throw new ArgumentException("The length of the variable names, lags, and coefficients vectors must match");
+
       ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
       ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
@@ -38,8 +45,16 @@
 
       for (int i = 0; i < variableNames.Length; i++) {
-        VariableTreeNode vNode = (VariableTreeNode)new Variable().CreateTreeNode();
-        vNode.VariableName = variableNames[i];
-        vNode.Weight = coefficients[i];
-        addition.AddSubtree(vNode);
+        if (lags[i] == 0) {
+          VariableTreeNode vNode = (VariableTreeNode)new Variable().CreateTreeNode();
+          vNode.VariableName = variableNames[i];
+          vNode.Weight = coefficients[i];
+          addition.AddSubtree(vNode);
+        } else {
+          LaggedVariableTreeNode vNode = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode();
+          vNode.VariableName = variableNames[i];
+          vNode.Weight = coefficients[i];
+          vNode.Lag = lags[i];
+          addition.AddSubtree(vNode);
+        }
       }
 
