Questions tagged [regression]

Regression analysis is a collection of statistical techniques for modeling and predicting one or multiple variables based on other data.

Wiki

Regression is a common applied statistical technique and a cornerstone of machine learning. Various algorithms and software packages can be used to fit and use regression models.

In other words, regression is a statistical measure that attempts to determine the strength of the relationship between one dependent variable (usually denoted by Y) and a series of other changing variables (known as independent variables). Typically the dependent variables are modeled with probability distributions whose parameters are assumed to vary (deterministically) with the independent variables.

Tag usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics and machine learning.

Read more:

9532 questions
2
votes
1 answer

Can I add standard errors *and* confidence intervals in a single column using Stargazer?

I like Stargazer quite a bit but am running into some issues trying to report standard errors and confidence intervals all in a single table. Consider this simple regression as a reproducible example: set.seed(04152020) x <- rnorm(100) y <- 2*x +…
Julian
  • 451
  • 5
  • 14
2
votes
2 answers

Is there a way to supress p-values in tbl_regression function in R?

To test whether there is an association between disease groups (categorical_variable) and a disease (outcome; count) I am running 3 negative binomial regression models. To display the ORs and CIs i am using the tbl_regression function from the…
tcvdb1992
  • 413
  • 3
  • 12
2
votes
1 answer

Accounting for Spatial Autocorrelation in Model

I am trying to account for spatial autocorrelation in a model in R. Each observation is a country for which I have the average latitude and longitude. Here's some sample data: country <- c("IQ", "MX", "IN", "PY") long <- c(43.94511, -94.87018,…
2
votes
0 answers

Problem with updating terms in the multinom function

I am trying to add1 all interaction terms on top of a multinomial baseline model using multinom() but it shows the error trying + x1:x2 Error in if (trace) { : argument is not interpretable as logical Called from: nnet.default(X, Y, w, mask = mask,…
cliu
  • 933
  • 6
  • 13
2
votes
0 answers

Neural Network cannot overfit even one sample

I am using neural network for a regression task. My input is an gray image whose size is 100x70x1. The gray area has a unique value 60. The input will go through a preprocessing layer, which multiply 1./255 on every pixel value. My output is just…
2
votes
1 answer

How are the test scores in cv_results_ and best_score_ calculated in scikit-optimize?

I'm using BayesSearchCV from scikit-optimize to optimise an XGBoost model to fit some data I have. While the model fits fine, I am puzzled by the scores provided in the diagnostic information and am unable to replicate them. Here's an example script…
2
votes
2 answers

What is the difference between LinearRegression and SGDRegressor?

I understand that both LinearRegression class and SGDRegressor class from scikit-learn performs linear regression. However, only SGDRegressor uses Gradient Descent as the optimization algorithm. Then what is the optimization algorithm used by…
2
votes
1 answer

Naming models using the value of the dependent variable in gtsummary

I have a list of 14 dependent variables for which I am running identical regression models (same model type, same independent variables). I'm using gather to get all of the dependent variables as a single outcome variable, running tbl_uvregression…
Kellan Baker
  • 375
  • 3
  • 11
2
votes
1 answer

Multilevel Regression with 3 Levels

I want to make a multilevel regression with 3 levels. I have data from a survey, where I have the information in which county the participants are living. So, I can also dinstinguish between East and West Germany. In the picture you can see what I…
2
votes
0 answers

How can i perform linear regression by groups of different sizes?

I have 2 tables. Table A has 105 rows: bbgid dt weekly_price_per_stock weekly_pct_change 0 BBG000J9HHN8 2018-12-31 13562.328 0.000000 1 BBG000J9HHN8 2019-01-07 34717.536 …
Miguel 2488
  • 1,410
  • 1
  • 20
  • 41
2
votes
1 answer

how does R handle NA values vs deleted values with regressions

Say I have a table and I remove all the inapplicable values and I ran a regression. If I ran the exact same regression on the same table, but this time instead of removing the inapplicable values, I turned them into NA values, would the regression…
2
votes
0 answers

Optimising nested for loops in R

I tried to speed the below code but without any success. I read about Rfast package but I also fail in implementing that package. Is there any way to optimise the following code in R? RI<-function(y,x,a,mu,R=500,t=500){ x <- as.matrix(x) dm <-…
jeza
  • 299
  • 1
  • 4
  • 21
2
votes
1 answer

How do I calculate R-squared value in JavaScript?

I need to calculate the R-squared value (Least Squares Method) for my regression model. How can I do this in JavaScript? For example I have this data: x = [5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6] y = [99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77,…
Jacob Philpott
  • 538
  • 1
  • 8
  • 24
2
votes
2 answers

change the default arguments of a function in R

I'm following up on this answer. I'm wondering if there is a way to set the default for argument rug to FALSE and argument multiline to TRUE in the plots generated by library(effects) as, for example, shown below in the code? library(effects) m <-…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
2
votes
2 answers

Is there a way to "Invert" a Neural Network in Tensorflow?

I'm training a Neural Network that, given some inputs that here we'll call x and y, is able to predict the output, z. So, z=f(x,y) Once the neural network is correctly trained, I'd like to be able to obtain a model that, given z and x, returns the…