Questions tagged [linear-regression]

for issues related to linear regression modelling approach

linear-regression
2,473 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
1 answer
255 views

Anomaly in test data-set for carrying out multivariate regression in python

I have a dataset (train, test and result) which consists of 32 Independent Variables and 5 Dependent Variables. To get a grasp of the data, I am trying to build a simple linear regression model on it ...
Shubhanshu's user avatar
  • 1,005
2 votes
1 answer
641 views

Java - Streaming Linear Regression

I am working on a project in Java that involves fitting a simple linear regression line through a rolling / sliding window of n data points. For each new point added the linear regression slope and ...
gavs's user avatar
  • 274
2 votes
0 answers
344 views

How do I determine the weight to assign to each bucket?

Someone will answer a series of questions and will mark each important (I), very important (V), or extremely important (E). I'll then match their answers with answers given by everyone else, compute ...
Joel's user avatar
  • 121
2 votes
1 answer
772 views

Adding Interaction Terms to MATLAB Multiple Regression

I am currently running a multiple linear regression using MATLAB's LinearModel.fit function, and I am bit confused in regards to how to properly add interaction terms to the model by hand. As I am ...
dwm8's user avatar
  • 309
2 votes
1 answer
5k views

Calculate 'R Square' and 'P-Value' for multiple linear regression in TSQL

We just have few built-in functions in SQL Server to do sophisticated statistical analysis but I need to calculate multiple linear regression in TSQL. Based on this post (Multiple Linear Regression ...
sqluser's user avatar
  • 5,572
2 votes
0 answers
2k views

why does backwards selection in regsubsets (R, leaps package) yield nonsensical results after rearranging variables in data frame?

I am attempting to do forwards and backwards selection using the Boston data from the MASS package with the regsubsets() function in the leaps package in R and to compare the models selected of each ...
Rebecca's user avatar
  • 21
2 votes
0 answers
2k views

Multivariate Multiple Regression in Python

I am trying to a perform a multivariate multiple linear regression, so I have multiple inputs and outputs that I am trying to optimize for. I would like to do this in python. Are than any software's ...
user3014093's user avatar
2 votes
1 answer
4k views

Specifying a Constant in Statsmodels Linear Regression?

I want to use the statsmodels.regression.linear_model.OLS package to do a prediction, but with a specified constant. Currently, I can specify the presence of a constant with an argument: (from ...
Max Song's user avatar
  • 1,637
2 votes
1 answer
2k views

Error when introducing dummy variables in a regression in Matlab

I am running some regressions in Matlab. My first three regressions are: tbl1=table(Y1,X1); mdl1=fitlm(tbl1,'Y1~X1'); mdl12=fitglm(tbl1,'Y1~X1','Distribution','binomial','link','probit'); mdl13=...
user3557054's user avatar
2 votes
2 answers
195 views

Performance issue in computing multiple linear regression with huge data sets

I am using np.linalg.lstsq for calculating the multiple linear regression. My data set is huge: has 20,000 independent variables(X) and 1 dependent variable (Y). Each independent variable has 10,000 ...
user2567857's user avatar
2 votes
0 answers
137 views

Why does regtol.int() resort my X variable in ascending order?

I'm pretty new at R, so I guess I must be doing something wrong. I have a dataset named "series" with two columns, V1=CP and V2=CU, and I want to perform a linear regression with CU as the independent ...
user3207297's user avatar
2 votes
0 answers
390 views

Pandas Rolling OLS Bug with Version 0.12.0

I have the following example data for performing a rolling OLS calculation (here I am doing it from the debugger): (Pdb) rhs ['Yield'] (Pdb) lhs 'Returns' (Pdb) min_periods 12 (Pdb) window 60 (...
ely's user avatar
  • 76.1k
2 votes
0 answers
890 views

R - Fitting a constrained AutoRegression time series

I have a time-series which I need to fit onto an AR (auto-regression) model. The AR model has the form: x(t) = a0 + a1*x(t-1) + a2*x(t-2) + ... + aq*x(t-q) + noise. I have two contraints: Find the ...
Paul's user avatar
  • 73
2 votes
1 answer
4k views

Matlab plot regression function

I'm plotting a linear regression using the MATLAB function plotregression in this way: hand = plotregression(x, y, 'Regression') However, I'd like to get rid of the y = T line in the plot, and also ...
Paula's user avatar
  • 21
2 votes
1 answer
1k views

regression coefficient calculation in python

I have a Dataframe and an input text file of activity.Dataframe is produced via pandas.I want to find out the regression coefficient of each term using following formula Y=C1aX1a+C1bX1b+...+C2aX2a+...
user2051726's user avatar
2 votes
1 answer
1k views

Logistic Regression with R and Hadoop

We are using rmr and rhadoop package of RevoR. Can we perform linear regression on an entire data set in hadoop without the need to implement the linear regression algorithm in map reduce or Is ...
Samzer's user avatar
  • 21
2 votes
0 answers
1k views

Trouble installing MathNet.Numerics in VS2010 Express, System.Numerics is missing?

I'm new here, just getting my feet wet writing my first Windows Phone 7 app. Specifically, I need to do linear regression on some data to get a simple y=Ax^2+Bx+C best fit curve. After some ...
Keegan's user avatar
  • 21
2 votes
1 answer
1k views

How to split data to train and test ? Cross validation possible ? M-estimation or OLS?

I have 26 observations to apply a simple linear regression but when I split the data to 70% for train and 30% for test data usually the results for the test data (R squared / P value) are not good. Is ...
AhmAch's user avatar
  • 105
2 votes
1 answer
2k views

Regressing out or Removing age as confounding factor from experimental result

I have obtained cycle threshold values (CT values) for some genes for diseased and healthy samples. The healthy samples were younger than the diseased. I want to check if the age (exact age values) ...
rj dj's user avatar
  • 270
1 vote
1 answer
15 views

LinearRegression with large number of features and targets, but small number of samples runs out of memory

I have a huge number of feature and targets, but small number of samples. It turns out, that in such case a simple linear regression with numpy.linalg.pinv works much better than sklearn.linear_model....
user36313's user avatar
  • 143
1 vote
0 answers
26 views

Problem with cros_val_score with Linear Regression

I have this code where I don't understand where the error is when I calculate the cross_val_score. You can find the code at the end. When I insert X and Y into cross_val_score I get this output= [-1....
Marco Di Giacomo's user avatar
1 vote
0 answers
30 views

How to clear GPU in training loop using Keras?

I've been exploring methods to train multiple models within a single codebase. The aim is to generate various models using different seeds to assess diverse architectures and training data. The data ...
Agenor Maradiaga's user avatar
1 vote
0 answers
31 views

MinMaxScaler caused much worse result (R2 is lower) in linear regression

I was trying to apply linear regression for an automobile dataset where some of variables are categorical and the target is the price. I wanted to scale the variables, but using scaler makes the ...
Yuno's user avatar
  • 11
1 vote
1 answer
29 views

Display trendline equations for facet wrapped date

I am working with a lot of data looking for variation in spider behavior. Here, multiple behaviors were recorded for multiple spiders in an experiment simulating rain. I have the amount of time each ...
Katie Van Havel's user avatar
1 vote
0 answers
54 views

Periodic/sinusoid MSE loss in the custom implementation of linear regression

I was implementing PyTorch-like modules (for educational purposes), and ran a simple training routine to check. However, my loss is oscillating, and I am not sure why. Below is the code. I put the ...
RafazZ's user avatar
  • 4,309
1 vote
1 answer
55 views

ggplot with linear regression, beta coefficient per year

I have a dataframe called df with a date and an age variable. I want to plot these variables, add a linear regression line and the corresponding formula. ggplot(df, aes(date, age)) + geom_point() + ...
Gnueghoidune's user avatar
  • 1,317
1 vote
0 answers
32 views

Error in model.matrix.default(random, data = a) : model frame and formula mismatch in model.matrix() using "mixcat" package and "npmlt()" command

I am trying to run a Mixed Effect Multinomial Logistic Regression Model in R using mixcat package and npmlt() command. Two random effects (participant id ("id" and day ("tag") ...
Cristina Balemi's user avatar
1 vote
0 answers
42 views

Computing a piecewise-linear approximation of a function of three variables

Imagine that you have a bunch of points in R3, each with a value (say, temperature). You want to construct a regular grid in R3 and compute a value at each grid point, such that if you then use ...
Andrew Certain's user avatar
1 vote
0 answers
25 views

Why are my VIF scores so low, but in my OLS Regression Results, I get a warning: the condition number is large 1.98 * 10^3, possible multicollinearity

mport pandas as pd import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm import seaborn as sns from statsmodels.stats.outliers_influence import variance_inflation_factor from ...
Adonistats's user avatar
1 vote
1 answer
34 views

Linear regression using groupby and sklearn: How do I save the results of model.score in a new dataframe with the associated group name?

I have a dataset with 99 groups. Below is an example subset containing three groups. Name conc height 0 Oxaloacetate 20 9047 1 Oxaloacetate 50 24966 2 Oxaloacetate 100 47028 3 L-...
r brad's user avatar
  • 11
1 vote
1 answer
101 views

Keep 0.1% samples to be outliers in HuberRegressor

When I run Huber regression on a certain data set using HuberRegressor() form sklearn.linear_model, I want to keep 0.1% of all samples to be outliers. As I know, HuberRegressor() controls the size of ...
Beitian Ma's user avatar
1 vote
0 answers
39 views

Create lm/glm class object using predetermined beta coefficients

I have a list of beta coefficients values that I generated through a Bayesian analysis in JAGs but would love to simply plug them into a simple function like lm() so that I can use the summary ...
Austin Zeller's user avatar
1 vote
0 answers
47 views

Extraction from Regsusbsets model

I'm calling for help. I'm using regsubsets to find the combination of independent variables that maximizes the adjusted r squared. I choose an nvmax which corresponds to the total of my number of ...
Cédric Delaveau's user avatar
1 vote
0 answers
33 views

Apply the function segmented() to each element of a list created with map()

I am studying cumulative weight loss in honey bee hives. I have a dataset with cumulative weight running average (3days), id of the hive, ndate (day in Unix timestamp) and day (in POSIXct timestamp). ...
Giulia Mainardi's user avatar
1 vote
0 answers
104 views

Possible bias when fitting linear regression with errors in variables using TMB

I am new to template model builder (TMB), and I am trying to use it to fit a simple linear regression with errors in variables as a learning exercise. My ultimate goal is to apply this to more complex ...
Darren G's user avatar
1 vote
1 answer
319 views

Linear regression over months

I'm trying to create a linear regression measure that can be used over months instead of date. However there is something with my table variables that doesn't work and I don't know why. I have this ...
Håkan Rolin's user avatar
1 vote
1 answer
399 views

ValueError: X has 28 features, but LinearRegression is expecting 22 features as input

I'm trying to figure out the importance of certain features in being able to predict the correct label. I'm working on getting the linear regression of my data first but I'm getting errors during the ...
Jesper Ezra's user avatar
1 vote
1 answer
85 views

Multiple linear regression with GEKKO

Okay, so I need to complete a linear regression in which I fit predicted histograms to an experimental set. The relationship must be linear, and I know for a fact that there are possible solutions. ...
Sakshi Krishna's user avatar
1 vote
1 answer
262 views

Issue with combining regression model and ARIMA errors in time series forecasting

I am working on a time series forecasting problem using a combination of a regression model and ARIMA errors. The regression model is implemented using the sm.OLS function from the statsmodels library,...
sdave's user avatar
  • 540
1 vote
1 answer
145 views

Why am I getting a wrong prediction values when using statsmodels.formula.api / statsmodels.api in Python?

I'm trying to get the prediction values of a Simple Linear Regression model created with Stats models in Python. I get the next results of the model: Intercept 0.2750 SAT 0.0017 So my ...
Ricardo Jaramillo's user avatar
1 vote
0 answers
269 views

Calculate Newey West adjusted t-statistic with statsmodel libary after FamaMac-Beth regression

I am currently running a multivariate Fama-MacBeth regression (Fama and MacBeth, 1973) on a dataset containing the risk factors MRI, SMB and HML in this example. In my analysis, I need to exclude ...
Korvex91's user avatar
1 vote
0 answers
50 views

Calculating with Function in Bash

I have a project assignment during my study on Linux and decided to make a program to predict data with Linear Regression. The program is using Bash and is still far away from finishing. Here is an ...
Luthfi Hakim's user avatar
1 vote
1 answer
143 views

Multiple regression for percentiles using Math.NET

I am currently using Fit.MultiDim from Math.NET to calculate an estimated value for a data set that has 2 dimensions like so: using MathNet.Numerics; using System.Collections.Generic; using System....
Marin Petkov's user avatar
  • 2,128
1 vote
0 answers
280 views

How to fit Bayesian generalised additive models with R and Stan

Background When fitting generalised additive models (GAMs) in the past, I have used methods for the mgcv package outlined in Pedersen EJ, Miller DL, Simpson GL, Ross N (2019) Hierarchical generalized ...
Luka Seamus Wright's user avatar
1 vote
0 answers
165 views

php-ml regression issues. Trying to predict price but there is an error

This was my error: Fatal error: Uncaught TypeError: Phpml\CrossValidation\Split::__construct(): Argument #1 ($dataset) must be of type Phpml\Dataset\Dataset, array given, called in C:\xampp\htdocs\...
Arshado's user avatar
  • 41
1 vote
0 answers
13 views

Various linear regressions that activate in linear regression within the same model

I want to create a linear regression of the next sort: $$Y=(1-\sigma)(\alpha_i + \beta_i x)+ \sigma(\alpha_j+\beta_j x)+\varepsilon$$ Where sigma refers to different time periods. I want to run it ...
emithemex's user avatar
1 vote
1 answer
202 views

Is regularization (Ridge/Lasso) implemented in statsmodels' GLM model?

I have the following model: from statsmodels.formula.api import glm modelSpecification = glm( formula="wage ~ workhours + gender", data=train, ...
Xtiaan's user avatar
  • 296
1 vote
0 answers
35 views

Impact of IV on coefficients for exogenous regressors

I am sorry if my question sounds a bit naive, but I am new to IV and have a problem. One of the variables in my regression is endogenous, and I use 2SLS to remove bias. In stage 2 I focused on the ...
Mikhail's user avatar
  • 49
1 vote
1 answer
23 views

How can I perform multiple linear models by accumulating the groups in R?

I have a database with stable isotope measurements: deuterium and oxygen_18. Year Deuterium Oxygen_18 2005 -28 -4.6 2005 -27 -4 2005 -47 -6.1 2005 -28 -3.8 2005 -54 -7.2 2005 -...
kmilovelez's user avatar

1
3 4
5
6 7
50