6,550 questions
3
votes
1
answer
71
views
Plot the best fit linear regression with the slope set to a fixed value (m=1)
Currently using R 4.4.3 on Windows 11. I'm plotting the following data set with ggplot2 and performing a linear regression with geom_smooth:
df <- data.frame(A= c(1.313, 1.3118, 1.3132, 1.3122, 1....
0
votes
0
answers
49
views
Doesn't imputing missing values affect the data quality? [closed]
I'm doing multiple linear regression for a dataset.
The numeric_df dataframe is the continuous variables in the orignal dataframe.
I want to check linearity between the price variable (target) and the ...
-4
votes
0
answers
37
views
Linearity of model [closed]
I have been studying linearity of model and it is said that a model is considered linear (or linear model) if the output is a linear combination of the inputs, meaning the inputs are only scaled by ...
4
votes
2
answers
55
views
Residual Analysis for simple linear regression model
I'm trying to conduct the residual analysis for simple linear regression. I need to prove that the residuals follow an approximate Normal Distribution.
The csv file I'm using has values for Percentage ...
0
votes
0
answers
26
views
Python's analog of xtregar
I'm new in Python. I would like to know wheter there is a package that performs the same thing as Stata's 'xtregar' ou R's 'panelAR'.
I would like to estimate the following regression
Y_{i,t}=\alpha+\...
5
votes
1
answer
53
views
Does the way you numerically encode data for a regression matter?
I'm looking to build out a multiple regression in Python and need to numerically encode my categorical data. I have fields such as gender (Male, Female, Prefer not to Say), education level (High ...
-1
votes
0
answers
40
views
How to Balance Uneven Feature Scales in Multivariable Linear Regression?
I'm about to perform a multivariable linear regression.
I have two independent variables that I'll use to predict y:
The first variable is body shape data, which has only a single value (e.g., [1]).
...
0
votes
0
answers
29
views
Add weighting function to an existing Pine Script
The pine-script below is a variant of a script published by henryph24 to plot the linear regression slope:
//This source code is subject to the terms of the Mozilla Public License 2.0 at https://...
2
votes
1
answer
109
views
Why does SequentialFeatureSelector return at most "n_features_in_ - 1" predictors?
I have a training dataset with six features and I am using SequentialFeatureSelector to find an "optimal" subset of the features for a linear regression model. The following code returns ...
0
votes
0
answers
16
views
Validity of forcing line through origin in multiple regression
I am trying to fit a multiple regression model to my data. I am testing the hypothesis that outcome Y is linearly related to independent variable X, while controlling for a linear relationship with ...
0
votes
0
answers
14
views
LinearRegression object has no attr coef_ (in pipeline)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
num_features, bin_features, cat_features = split_features(X)
preprocessor = ColumnTransformer([
('num', ...
3
votes
2
answers
89
views
How to generate a polynomial regression formula from a list of column names
It's in the title, however here is an example
# df is the sample data
df <- data.frame(a = c(1:10), b= c(10:20), c = c(20:30), d= c(30:40))
rq_cols <- c(a,b,c)
#the desired output is:
fn <- ...
0
votes
0
answers
27
views
How can I extract absolute beta coefficients for all levels of multiple categorical variables in statsmodels?
I’m performing linear regression in Python with statsmodels. I have two categorical predictors:
sample: a factor with 8 levels
distractor: a factor with 2 levels
My goal is to determine the “...
0
votes
0
answers
22
views
How to perform OLS regression in Matlab with constraints on coefficients?
I want to apply constrained ordinary least-squares regression similar to what is done with R here, but in Matlab. The documentation doesn't suggest how to accomplish this with the available routine ...
2
votes
0
answers
38
views
How can I prevent stepAIC in caret::train from removing main effects involved in interaction terms to maintain hierarchical regression principles?
I’m using caret::train in R with method = "glmStepAIC" to perform stepwise regression with repeated cross-validation (trControl = splitRule). My model includes interaction terms and I want ...