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
11
votes
5 answers

Pandas - Rolling slope calculation

How to calculate slope of each columns' rolling(window=60) value, stepped by 5? I'd like to calculate every 5 minutes' value, and I don't need every record's results. Here's sample dataframe and results: df Time A ... …
Lcy
  • 335
  • 2
  • 3
  • 10
11
votes
2 answers

Arima/Arma Time series Models in Java

I am looking for an Arima time series models in java. Is there any Java library implementing Arima/Arma model?
Prashant
  • 351
  • 2
  • 3
  • 5
11
votes
3 answers

plot regression line in R

I want to plot a simple regression line in R. I've entered the data, but the regression line doesn't seem to be right. Can someone help? x <- c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120) y <- c(10, 18, 25, 29, 30, 28, 25, 22, 18, 15, 11,…
J.doe
  • 225
  • 1
  • 2
  • 9
11
votes
2 answers

How to implement Poisson Regression?

There are 2 types of Generalized Linear Models: 1. Log-Linear Regression, also known as Poisson Regression 2. Logistic Regression How to implement the Poisson Regression in Python for Price Elasticity prediction?
User456898
  • 5,704
  • 5
  • 21
  • 37
11
votes
1 answer

glmnet: How do I know which factor level of my response is coded as 1 in logistic regression

I have a logistic regression model that I made using the glmnet package. My response variable was coded as a factor, the levels of which I will refer to as "a" and "b". The mathematics of logistic regression label one of the two classes as "0" and…
John Kleve
  • 499
  • 1
  • 4
  • 12
11
votes
2 answers

How to interpret lm() coefficient estimates when using bs() function for splines

I'm using a set of points which go from (-5,5) to (0,0) and (5,5) in a "symmetric V-shape". I'm fitting a model with lm() and the bs() function to fit a "V-shape" spline: lm(formula = y ~ bs(x, degree = 1, knots = c(0))) I get the "V-shape" when I…
PDG
  • 287
  • 1
  • 3
  • 14
11
votes
3 answers

Polynomial regression in R - with extra constraints on the curve

I know how to do a basic polynomial regression in R. However, I can only use nls or lm to fit a line that minimizes error with the points. This works most of the time, but sometimes when there are measurement gaps in the data, the model becomes…
Yang Li
  • 462
  • 1
  • 8
  • 21
11
votes
1 answer

ggplot2: How to curve small gaussian densities on a regression line?

I want to graphically show the assumptions of linear (and later other type) regression. How can I add to my plot small Gaussian densities (or any type of densities) on a regression line just like in this figure:
Maju116
  • 1,607
  • 1
  • 15
  • 30
11
votes
1 answer

Log transform dependent variable for regression tree

I have a dataset where I find that the dependent (target) variable has a skewed distribution - i.e. there are a few very large values and a long tail. When I run the regression tree, one end-node is created for the large-valued observations and one…
airjordan707
  • 111
  • 1
  • 1
  • 4
11
votes
2 answers

Model matrix with all pairwise interactions between columns

Let's say that I have a numeric data matrix with columns w, x, y, z and I also want to add in the columns that are equivalent to w*x, w*y, w*z, x*y, x*z, y*z since I want my covariate matrix to include all pairwise interactions. Is there a clean and…
encircled
  • 159
  • 1
  • 1
  • 7
11
votes
2 answers

Regression trees or Random Forest regressor with categorical inputs

I have been trying to use a categorical inpust in a regression tree (or Random Forest Regressor) but sklearn keeps returning errors and asking for numerical inputs. import sklearn as sk MODEL =…
jpsfer
  • 594
  • 3
  • 7
  • 18
11
votes
3 answers

Predicting Football match winners based only on previous data of same match

I'm a huge football(soccer) fan and interested in Machine Learning too. As a project for my ML course I'm trying to build a model that would predict the chance of winning for the home team, given the names of the home and away team.(I query my…
keithxm23
  • 1,280
  • 1
  • 21
  • 41
11
votes
5 answers

Block bootstrap from subject list

I'm trying to efficiently implement a block bootstrap technique to get the distribution of regression coefficients. The main outline is as follows. I have a panel data set, and say firm and year are the indices. For each iteration of the…
baha-kev
  • 3,029
  • 9
  • 33
  • 31
11
votes
5 answers

Why does lm run out of memory while matrix multiplication works fine for coefficients?

I am trying to do fixed effects linear regression with R. My data looks like dte yr id v1 v2 . . . . . . . . . . . . . . . I then decided to simply do this by making yr a factor and use lm: lm(v1 ~…
Alex
  • 19,533
  • 37
  • 126
  • 195
11
votes
2 answers

correct usage of scipy.optimize.fmin_bfgs

I am playing around with logistic regression in Python. I have implemented a version where the minimization of the cost function is done via gradient descent, and now I'd like to use the BFGS algorithm from scipy (scipy.optimize.fmin_bfgs). I have a…
ACEG
  • 1,981
  • 6
  • 33
  • 61