Questions tagged [olsmultiplelinearregression]
29 questions
0
votes
0 answers
How to stop this while loop from looping infinitely?
Please help me figure how to stop the infinite loop. This is a code for backward elimination. Im trying to put this code in my homework because if I do backward elimination manually it will waste a lot of my time. The dataset has 78 independent…
0
votes
1 answer
Changing the assigned dummy variable classification when using drop_first
I generated the following dummy variables for the data to be used for a linear regression model.
data = df.copy() #make a copy of our cleaned dataset called data
X = data[['age', 'blood_pressure', 'specific_gravity', 'albumin', 'sugar',
…

ActuS98
- 11
- 2
0
votes
1 answer
What are possible reasons for a p-value of 0.00 in statsmodels' multiple regression test?
I am doing a multiple regression test with statsmodels.
I am very confident that there is a relationship in the data, both from what I already know about this data through other sources and from plotting, but when I do a multiple regression test…

C4X
- 87
- 8
0
votes
1 answer
How should I interpret to negative constant in multiple linear regression in python?
I have a dataset. A part of the dataset is as shown below:
sales_date net_sales_my_firm net_sales_others pro_unit_my_firm pro_unit_others
1.02.2021 101089 710337 9869 67885
1.03.2021 104747 …

Rachel
- 15
- 4
0
votes
0 answers
Error of "type 'float' has no len() when trying BackwardElimination algorithm in Python
I would like to know if someone could help me solving this issue I'm facing.
First of all: I'm using Visual Studio Code.
Pandas, matplotlib (that maybe is not even needed), statsmodels, numpy and sklearn were all installed with the code pip install…

Angelj107
- 1
- 1
- 1
0
votes
2 answers
Create a loop in R to run all possible combinations of categorical variables(levels) in regression
I am trying to run different multiple linear regression models in R with my sales dataset containing over 1000 products and 250 retailers. I am interested in looking at the model coefficients for each product and retailer combination. I tried using…

asterisk21
- 1
- 1
0
votes
1 answer
I() equivalent (used in R), what is the Python equivalent?
The I() function in R is used to create new predictor in Linear Regression, such as X^2 for example:
lm.fit2=lm(medv∼lstat +I(lstat ^2))
A good explanation is given here (What does the capital letter "I" in R linear regression formula mean?).
I'm…

user42
- 871
- 1
- 10
- 28
0
votes
0 answers
Value error : Shapes not aligned in Multiple linear regression model
I am trying to build a linear model by using both Sklearn's linear regression and statsmodels.api.
The approach is to drop variables whose p-values and VIF values are higher than the norm (p-value : 0.05, VIF : <5)
bike_train columns are August,…

user10528004
- 35
- 1
- 2
- 7
0
votes
1 answer
Linear Regression and Generating Data =+
I have been given a problem in Jupiter notebooks to code using python. This problem is about linear regression. It's as follows:
1: Linear Regression
In this notebook we will generate data from a linear function: =+ and then solve for ̂ using…

ah123412312
- 3
- 3
0
votes
1 answer
How to use statsmodels.api for fitting model using OSL
Below is the code from udemy course:-
I tried all the solutions provided in stack overflow but nothing seems to work
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('50_Startups.csv')
X =…

Soumitro
- 1
- 2
0
votes
1 answer
How to interpret Linear regression assumptions of the data
I have a data set with 3719 observation with 9 features. In that I have performed multiple linear regression with selected features.
I got the diagnostic plots like this:
I have understood by plots that there is no linearity between dependent and…

Navya
- 307
- 3
- 15
0
votes
2 answers
error while printing the predicted value in multiple linear regression
from sklearn import linear_model
regr = linear_model.LinearRegression()
x = np.asanyarray(train[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB']])
y = np.asanyarray(train[['CO2EMISSIONS']])
regr.fit (x, y)
# The coefficients
print ('Coefficients:…
0
votes
0 answers
NumberFormatException thrown as OLS concatenates variables
I am trying to run an OLS regression, the code works fine with an exception that it concatenates the variables into one. I have tried looking into what could be the problem but I've not been able to find the reason
@Component
public class AppRunner…

ken4ward
- 2,246
- 5
- 49
- 89
-1
votes
1 answer
Multiple linear Regression calculate coefficients Java
I am currently trying to perform an Multiple linear regression within my Java Project.
I already tried many different classes like the OLSMultipleLinearRegression Class.
But those classes don't return the parameters I need. For example these are the…

Bl0ss0m
- 1
- 2