LunchBox Linear Regression and Multivariate Regression vs. python results

Hi all,

  1. While fitting a curve through linear regression method, using Grasshopper LunchBox, I noticed numbers do not match up with those calculated by python. However small, the discrepancy is really annoying.

test (36.5 KB)
test 02.csv (1.6 KB)

  1. The second issue is the way input and output data are used in the template file provided by the plug-in developer. I suspect the input seeks “two or more” independent data—or predictors—whereas the output is where the dependent data is fed. The template shows otherwise; two output and one input.

The template, provided by the developer: (25.0 KB)

Your suggestions and/or hints/solutions are highly appreciated.

Since the edit option is seemingly not available, I am gonna raise an alternative question in this regard.

This python code:

import pandas as pd
import statsmodels.api as sm
import seaborn as sns
import matplotlib.pyplot as plt

points = pd.read_csv("...3d points.csv")
model2 = sm.OLS.from_formula('y ~ x + z', data=points).fit()

print (model2.params)

sns.lmplot(x='x', y='y', palette='Blues', fit_reg=False, data=points)

plt.plot(points.x, model2.params[0]+model2.params[1]*points.x+model2.params[2]*-2, color='lightblue', linewidth=5)
plt.plot(points.x, model2.params[0]+model2.params[1]*points.x+model2.params[2]*4, color='blue', linewidth=5)
plt.plot(points.x, model2.params[0]+model2.params[1]*points.x+model2.params[2]*6, color='darkblue', linewidth=5)

Generates these results:

Intercept    18.172019
x             0.242383
z             1.625571

The grasshopper component of multivariate regression, however, provides different results (coefficients and the intercept). (22.5 KB)
3d points.csv (2.1 KB)

How do we interpret this discrepancy?
if the question is fundamentally wrong, I would appreciate it if anyone could show me what the right question is like.