I have a dataset with predicted and observed data. The equation that predicts the data is given by: y = AfT
With Af = constant (now at 1.35), T = wave period, g = gravitation 9.81, h = wave height.
Id like to use linear regression to find the best fitted coefficient (Af in the equation), so that the predicted value is closer to the observed data.
I now have Af = 1.35 (from suggestion in the literature) results in r^2 = 0.5676 Ideally, I`d use python to find the best fitted coefficient for my data.
import statsmodels.formula.api as smf
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris
X = np.array([11.52, 11.559, 12.31, 16.46, 11.84, 7.38, 9.99, 16.72, 11.617, 11.77, 6.48, 9.035, 12.87, 11.18, 6.75])
y = np.array([25.51658407, 24.61306145, 19.4007494, 24.85111923, 25.99397106, 14.30284824, 17.69451713, 27.37460301, 22.23326366, 18.44905152, 10.28001306, 10.68681843, 28.85399089, 14.02840557, 18.41941787]).reshape((-1, 1))
X, y = load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0).fit(X, y)
X = observed/measured values in the field, y = the predicted values of X using the equation
I have difficulties incorporating the actual equation and finding the best fit for Af.