I need to use Non Linear Regression like in the video but for my text file called ammonia. I started and i am getting errors I do not know how to solve.
import numpy as np
from plotly.subplots import make_subplots
data= np.loadtxt("ammonia.txt", skiprows=5)
print(data)
T= data[:,0]
logP= np.log10(data[:,1])
fig = make_subplots(rows=1, cols=1)
fig.add_scatter(x=T, y=logP, mode='markers', name='Data')
fig.update_layout(height=600, width=800)
X= np.c_[T, -logP, np.ones_like(T)]
A,C,D = np.linalg.inv(X,T@X)@X.T@(T*logP)
B= (A*C) - D
Tplot= np.linspace(min(T), max(T), 100)
fig.add_scatter(x=Tplot, y= A - (B/(Tplot+C)), mode= 'lines', name='Linear Regression')