     }
     
     public struct Result {
-        public let ln_model: String
+        public let lnModel: String
         public let cor: Double
         public let x: Double
         public let y: Double
     }
     
-    /// Builds the prediction of the expected value of y with the given x, based on linear regression model.
+    /**
+     Builds a prediction of the expected value of y with the given x, based on linear regression model.
+     */
     open func build() throws -> Result {
-        // Check the number of observations in a given dataset
+        // Check the number of observations
         guard count >= 3 else {
-            throw ArgumentError.error(msg: "The dataset should contain a minimum of 3 observations.")
+            throw ArgumentError.general(msg: "The dataset should contain a minimum of 3 observations.")
+        }
+        
+        // Check the number of x and y
+        guard count == xVector.count else {
+            throw ArgumentError.general(msg: "Mismatch in the number of x and y in the dataset.")
         }
         
         let b = round_(number: bSlope())

            square(v: sum[v]!() / Double(count))
    }
    
    /// The intercept
    /// a = (ΣY - b(ΣX)) / N
    private func aIntercept(b: Double) -> Double {
        return (sum(vector: yVector) / Double(count)) -
            (b * (sum(vector: xVector) / Double(count)))
    }
    
    /// The slope, or the regression coefficient
    /// b = ((ΣXY / N) - (ΣX / N)(ΣY / N)) / (Σv² / N) - (Σv / N)²
    private func bSlope() -> Double {
        return ((sumXY(data: data) / Double(count)) -
            ((sum(vector: xVector) / Double(count)) *

        let y = round_(number: model(x))
        
        return Result(
            lnModel: "\(a) + \(b)x",
            cor: round_(number: corCoefficient(b: b)),
            x: x,
            y: y
