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, Id use python to find the best fitted coefficient for my data.

import statsmodels.formula.api as smf
from sklearn.linear_model import LogisticRegression

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))

clf = LogisticRegression(random_state=0).fit(X, y)

print(clf.coef_, clf.intercept_)
`

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. Apr 11 23 views

## Is there a way to force the coefficient of the independent variable to be a positive coefficient in the linear regression model used in R?

A Few Constraints This is an example of ...READ MORE

## Scikit-Learn Linear Regression how to get coefficient's respective features?

What I discovered to be effective was ...READ MORE

## Negative coefficients in regression for positive coefficient of correlation

The situation you describe is not out ...READ MORE

## What is the difference between Coefficient of Regression and Elasticity

It is questionable. I'll simplify the model ...READ MORE

## Python code for basic linear regression

Hi @Dipti, you could try something like ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote