I am trying to learn how to fit a quadratic regression model. The dataset can be downloaded from: https://filebin.net/ztr9har5nio7x78v
Let be "AdjSalePrice" the target variable and "SqFtTotLiving", "SqFtLot", "Bathrooms", "Bedrooms", "BldgGrade" the predictor variables.
Imagine that "SqFtTotLiving" will be the variable that will have the degree 2. Be the python code:
import pandas as pd
import numpy as np
import statsmodels.api as sm
import sklearn
houses = pd.read_csv("house_sales.csv", sep = '\t')#separador é tab
colunas = ["AdjSalePrice","SqFtTotLiving","SqFtLot","Bathrooms","Bedrooms","BldgGrade"]
houses1 = houses[colunas]
X = houses1.iloc[:,1:] ##
y = houses1.iloc[:,0] ##
How to fit a quadratic regression model using sklearn and statsmodels? I can only use linear regression ...