linear-regression Questions
8
Solved
I have two vectors of data and I've put them into pyplot.scatter(). Now I'd like to over plot a linear fit to these data. How would I do this? I've tried using scikitlearn and np.polyfit().
Allsopp asked 28/9, 2013 at 16:5
4
Solved
I tried fitting an OLS for Boston data set. My graph looks like below.
How to annotate the linear regression equation just above the line or somewhere in the graph? How do I print the equation in P...
Urinal asked 27/8, 2017 at 7:40
1
I've come across somewhat of a confusing topic relating to the syntax of multiple regression with explanatory variables and their interactions. A DataCamp explanation led me to think that:
lm(formu...
Barbet asked 17/2, 2022 at 22:11
3
Solved
Using the following small dataset:
bill = [34,108,64,88,99,51]
tip = [5,17,11,8,14,5]
I calculated a best-fit regression line (by hand).
yi = 0.1462*x - 0.8188 #yi = slope(x) + intercept
I've pl...
Telespectroscope asked 1/4, 2017 at 3:34
5
Solved
I am using Linear regression to predict data. But, I am getting totally contrasting results when I Normalize (Vs) Standardize variables.
Normalization = x -xmin/ xmax – xmin
Zero Score Standard...
Tushy asked 20/8, 2015 at 1:32
2
Solved
I calculated a model using OLS (multiple linear regression). I divided my data to train and test (half each), and then I would like to predict values for the 2nd half of the labels.
model = OLS(la...
Gumm asked 4/11, 2012 at 12:21
8
I'm trying to perform feature selection by evaluating my regressions coefficient outputs, and select the features with the highest magnitude coefficients. The problem is, I don't know how to get th...
Dustproof asked 15/11, 2014 at 23:14
3
Solved
Just like we use the Normal Equation to find out the optimum theta value in Linear Regression, can/can't we use a similar formula for Logistic Regression ? If not, why ? I'd be grateful if could so...
Tallent asked 23/6, 2016 at 16:36
8
I've trained a Linear Regression model with R caret. I'm now trying to generate a confusion matrix and keep getting the following error:
Error in confusionMatrix.default(pred, testing$Final) :
th...
Babel asked 2/5, 2015 at 11:57
4
Is there a library in python to do segmented linear regression?
I'd like to fit multiple lines to my data automatically to get something like this:
Btw. I do know the number of segments.
Handbarrow asked 25/1, 2012 at 7:55
8
I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric.
This ...
Hoye asked 24/6, 2016 at 13:57
3
I am working with sklearn and specifically the linear_model module. After fitting a simple linear as in
import pandas as pd
import numpy as np
from sklearn import linear_model
randn = np.random.ra...
Butternut asked 13/3, 2014 at 14:20
6
I am trying to use Ordinary Least Squares for multivariable regression. But it says that there is no attribute 'OLS' from statsmodels. formula. api library.
I am following the code from a lecture o...
Adamok asked 4/6, 2019 at 18:57
3
When it comes to measuring goodness of fit - R-Squared seems to be a commonly understood (and accepted) measure for "simple" linear models.
But in case of statsmodels (as well as other statistical ...
Nought asked 27/7, 2015 at 14:0
15
Solved
I can't seem to find any python libraries that do multiple regression. The only things I find only do simple regression. I need to regress my dependent variable (y) against several independent vari...
Velvety asked 13/7, 2012 at 22:14
3
Solved
Is there a way to create a Seaborn line plot with all the lines gray and the mean as a red line? I'm trying to do this with relplot but I don't know how to separate the mean from the data (and it a...
Dannielledannon asked 19/5, 2021 at 22:20
3
My DataFrame object looks like
amount
date
2014-01-06 1
2014-01-07 1
2014-01-08 4
2014-01-09 1
2014-01-14 1
I would like a sort of scatter plot with time along the x-axis, and amount on the y, w...
Chloris asked 27/3, 2015 at 19:28
1
Solved
I have seen similar posts like this one which say that getting the error message saying: Coefficients: (1 not defined because of singularities) is because of nearly perfect correlation among predic...
Saprolite asked 29/8, 2021 at 18:36
2
I am currently running multiple linear regression on a dataset. At first, I didn't realize I needed to put constraints over my weights; as a matter of fact, I need to have specific positive & n...
Garrow asked 18/5, 2018 at 11:10
1
Solved
I'm using the felm() function from the lfe package to fit linear models with large numbers of fixed effects. I would like to be able to fit a model using only fixed effects. For instance, I'd like ...
Volute asked 19/5, 2017 at 1:16
3
I'm trying to find a way to fit a linear regression model with positive coefficients.
The only way I found is sklearn's Lasso model, which has a positive=True argument, but doesn't recommend using ...
Antimagnetic asked 14/3, 2016 at 11:43
1
Solved
I have a sample time-series dataframe:
df = pd.DataFrame({'year':'1990','1991','1992','1993','1994','1995','1996',
'1997','1998','1999','2000'],
'count':[96,184,148,154,160,149,124,274,322,301,30...
Trichina asked 28/5, 2021 at 11:4
1
I've been trying to get the standard error & p-Values by using LR from scikit-learn. But no success.
I've end up finding up this article: but the std error & p-value does not match that f...
Vickeyvicki asked 21/8, 2016 at 16:48
1
I am performing component wise regression on a time series data. This is basically where instead of regressing y against x1, x2, ..., xN, we would regress y against x1 only, y against x2 only, ...,...
Concerted asked 26/6, 2020 at 9:43
2
Solved
Given the following:
import numpy as np
import pandas as pd
import seaborn as sns
np.random.seed(365)
x1 = np.random.randn(50)
y1 = np.random.randn(50) * 100
x2 = np.random.randn(50)
y2 = np.rando...
Immutable asked 16/3, 2016 at 3:12
© 2022 - 2024 — McMap. All rights reserved.