category stringclasses 107
values | title stringlengths 15 179 | question_link stringlengths 59 147 | question_body stringlengths 53 33.8k | answer_html stringlengths 0 28.8k | __index_level_0__ int64 0 1.58k |
|---|---|---|---|---|---|
linear regression | Linear regression on the results of linear regression | https://stats.stackexchange.com/questions/324376/linear-regression-on-the-results-of-linear-regression | <p>I created a model for predicting a scalar variable from a set of features. I trained a linear regression on a training set, and used the resulting coefficients to produce predictions for a test set.</p>
<p>Then, I did simple linear regression to the predictions as a function of the ground truth values of the test s... | <p>It just tells you that you won't have perfect fit in a linear regression on realistic datasets. </p>
<p>First linear regression will not fit the data completely, so there will be some unexplained variance remaining between predictions and original output value (on train as well as test set). Your second model will ... | 0 |
linear regression | Log-linear regression vs. Poisson regression | https://stats.stackexchange.com/questions/261946/log-linear-regression-vs-poisson-regression | <p>In this <a href="https://stats.stackexchange.com/questions/86720/log-linear-regression-vs-logistic-regression">post</a>, OP asked the difference between log linear regression and logistic regression. Two answers in the post are very clear and directly address OP's question. </p>
<p>I understand log-linear regressio... | <p>A Poisson regression is a regression where the outcome variable consists of non-negative integers, and it is sensible to assume that the variance and mean of the model are the same. </p>
<p>A log-linear regression is usually a model estimated using linear regression, where the response variable is replaced by a new... | 1 |
linear regression | Difference between Univariate Linear Regression and Simple Linear Regression? | https://stats.stackexchange.com/questions/351325/difference-between-univariate-linear-regression-and-simple-linear-regression | <p>Is there any difference between <strong>Univariate Linear Regression</strong> and <strong>Simple Linear Regression</strong>? If so, what is the difference exactly? It seems both of them are exactly same. I would appreciate if anyone could cite a scientific paper that defines Univariate Linear Regression.</p>
| <p>A good start (I hope uncontentious) on this is simply to note that <strong>univariate</strong>, <strong>bivariate</strong> and <strong>multivariate</strong> denote focus on one, two or many variables respectively. (Other words such as <strong>trivariate</strong> can be found but seem much more rarely used and rarely... | 2 |
linear regression | Time series linear regression vs Linear regression | https://stats.stackexchange.com/questions/619730/time-series-linear-regression-vs-linear-regression | <p>Is it okay if my outcome for time series linear regression and linear regression is the same?</p>
<p>I have time series data with 756 observations and for each year there are 252 observations. The time series data is from 2015-2021. It is an individual data type.</p>
<p>All my independent variables are categorical a... | <p>As said in the comment, "time-series linear regression" is not a different model. As <a href="https://www.rdocumentation.org/packages/forecast/versions/8.21/topics/tslm" rel="noreferrer">its documentation says</a></p>
<blockquote>
<p><code>tslm</code> is largely a wrapper for <code>lm()</code> except that ... | 3 |
linear regression | compare Bayesian linear regression vs standard linear regression | https://stats.stackexchange.com/questions/393313/compare-bayesian-linear-regression-vs-standard-linear-regression | <p><strong>1st question,</strong></p>
<p>I recently learnt bayesian linear regression, but I'm confused that in what situation we should use bayesian linear regression, and when to use standard linear regression? What is the advantage of bayesian linear regression over standard one?</p>
<hr>
<p><strong>2nd question,... | 4 | |
linear regression | Linear Regression vs Keras | https://stats.stackexchange.com/questions/563448/linear-regression-vs-keras | <p>I created a dummy dataset and compared the performance of SKLearn LinearRegression and Keras.
Why is Keras producing horrible results compared to Linear Regression?</p>
<p>Code:</p>
<pre><code># Create Dataset
from sklearn.datasets import make_regression
X, y = make_regression(n_samples=5000, n_features=10, noise=0.... | 5 | |
linear regression | Linear Regression Doubt | https://stats.stackexchange.com/questions/507053/linear-regression-doubt | <p>I'm studying about Linear Regression and searching about it I found an example that was a graphics that the axis X was the Year and the axis Y was Price, but my doubt is: When we are talking about Year we need to treat that as a Time Series problem, yes? Also, Linear Regression applies just when the variables are co... | <p>You can relate Price to Year using <em>time series regression</em>.</p>
<p>A time series regression model for the setting you mention could be formulated like so:</p>
<p><span class="math-container">$Price_t = \alpha_0 + \beta_0 Year_t + \epsilon_t$</span></p>
<p>where <span class="math-container">$\epsilon_t$</span... | 6 |
linear regression | Linear regression VS linear modeling | https://stats.stackexchange.com/questions/126165/linear-regression-vs-linear-modeling | <p>Can I claim that linear regression and linear modeling are the same topics? If not, what is the difference?</p>
| <p>Comment made into an answer per suggestion of gung.</p>
<p>Linear modeling can have meanings, outside Statistics, well beyond the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Linear_model" rel="nofollow" title="Liinear Model">Linear Model</a> in whuber's comment above. For instance, Linear Programming <a ... | 7 |
linear regression | Linear Regression in groups / Multivariate regression | https://stats.stackexchange.com/questions/357540/linear-regression-in-groups-multivariate-regression | <p>I try to do a linear regression of 84 patients, 1 numeric variable =threshold, 1 nominal variable=Group for prediction of the target numeric variable = dist.</p>
<p>On the multivariate linear regression: threshold is statistical significant, and group isn't.
However, when I split the data for the 2 different groups... | 8 | |
linear regression | Linear regression vs. Individual linear regression | https://stats.stackexchange.com/questions/523851/linear-regression-vs-individual-linear-regression | <p>If we want to do multiple individual (componentwise) regression, (like the one used in <a href="https://fan.princeton.edu/papers/06/SIS.pdf" rel="nofollow noreferrer">Sure-Independent-Screening</a>, Fan & Lv 2007) we have that:</p>
<p><span class="math-container">$$\hat\beta_{ind} = \frac{1}{n}X^Ty$$</span></p>
... | <p><strong>Edit</strong>: I think my old answer is a bit inaccurate.
1st of all - regarding my question - <span class="math-container">$(X^TX)^{-1}$</span> is obviously not a projection matrix. By the mere fact that <span class="math-container">$P^2 \neq P$</span>.</p>
<p>2nd thing - there's seem to be a bit of confusi... | 9 |
linear regression | Linear regression | https://stats.stackexchange.com/questions/661411/linear-regression | <p>If I have a single model say y = ax^2 + bx + c, can I use 3 linear regression algorithms y=ax^2, y=ax and y=a to learn the original function if use the same data set. Please help me out here.</p>
| 10 | |
linear regression | Linear regression questions | https://stats.stackexchange.com/questions/577915/linear-regression-questions | <p>I am new to the field of machine learning and am just learning linear regression, and I have some questions about this concept:</p>
<p>Does linear regression allow vector-valued target variables?</p>
<p>Does linear regression not assume that the features are uncorrelated?</p>
| <blockquote>
<p>Does linear regression allow vector-valued target variables?</p>
</blockquote>
<p>You can formulate that way. It'll be a parallel set of equations, <span class="math-container">$y=X\beta$</span>, where <span class="math-container">$\beta$</span> is of size <span class="math-container">$f\times t$</span>... | 11 |
linear regression | Linear regression explanations | https://stats.stackexchange.com/questions/59782/linear-regression-explanations | <p>In explaining simple linear regression, isn't it a bit misleading for many examples to illustrate a straight line going through some scatterplot? This seems to suggest that linear regression only works if your independent and dependent variables have some sort of straight-line relationship, whereas the "linear" in l... | <p>Well, it's also linear in the predictors. </p>
<p>For example, if you fit a quadratic you might say 'see, not linear!'... but it is! If <span class="math-container">$x_1 = x$</span> and <span class="math-container">$x_2 = x^2$</span>, and you regress on <span class="math-container">$x_1$</span> and <span class="mat... | 12 |
linear regression | Simple linear regression vs Multiple Linear regression interpretation | https://stats.stackexchange.com/questions/579066/simple-linear-regression-vs-multiple-linear-regression-interpretation | <p>Suppose we have a multiple linear regression model with two predictors, <span class="math-container">$X_1$</span> and <span class="math-container">$X_2$</span>:
<span class="math-container">$$Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + \epsilon.$$</span></p>
<p>We can interpret <span class="math-container">$\beta_1$</sp... | <p>For the most part, you should read my answer to: <a href="https://stats.stackexchange.com/a/78830/7290">Is there a difference between 'controlling for' and 'ignoring' other variables in multiple regression?</a>, of which, this is nearly a duplicate.</p>
<hr />
<p>To address your explicit question more directly, <spa... | 13 |
linear regression | Is linear regression obsolete? | https://stats.stackexchange.com/questions/305116/is-linear-regression-obsolete | <p>I am currently in a linear regression class, but I can't shake the feeling that what I am learning is no longer relevant in either modern statistics or machine learning. Why is so much time spent on doing inference on simple or multiple linear regression when so many interesting datasets these days frequently violat... | <p>It is true that the assumptions of linear regression aren't realistic. However, this is true of all statistical models. "All models are wrong, but some are useful."</p>
<p>I guess you're under the impression that there's no reason to use linear regression when you could use a more complex model. This isn't true, be... | 14 |
linear regression | What is stepwise linear regression? | https://stats.stackexchange.com/questions/317625/what-is-stepwise-linear-regression | <p>I am reading about 'interaction effects on linear regression' <a href="https://jp.mathworks.com/help/stats/linear-regression-with-interaction-effects.html?lang=en" rel="nofollow noreferrer">here</a> and came across 'stepwise linear regression'. </p>
<p>There are originally 5 predictors in the model. This means to s... | <p>Stepwise Linear Regression is a method by which you leave it up to a statistical model test each predictor variable in a stepwise fashion, meaning 1 is inserted into the model and kept if it "improves" the model. Improve is defined by the type of stepwise regression being done, this can be defined by AIC, BIC, or an... | 15 |
linear regression | Coefficients linear and log-linear regression model | https://stats.stackexchange.com/questions/221910/coefficients-linear-and-log-linear-regression-model | <p>I performed both a linear and log-linear regression to predict the price of a smartphone based on its characteristics.
Now I have a question concerning the coefficients between the two models.</p>
<p>In the linear regression model, the dummy variable GPS included or not is 37,7.
This means that smartphone users pay... | <p>It's not just GPS, whose coefficient is "significant" in the linear price model but not in the log-price model. Many of your predictors change in apparent "significance" between the two models: screen size, memory, auto focus, flitsertype, too.</p>
<p>This is probably due to significant correlations among sets of y... | 16 |
linear regression | linear regression vs linear mixed effect model coefficients | https://stats.stackexchange.com/questions/161703/linear-regression-vs-linear-mixed-effect-model-coefficients | <p>It is my understanding that linear regression models and linear mixed effect regression models will produce the same regression coefficients (i.e., fixed effects); however, linear regression models produce downwardly biased standard errors leading to inflated Type I error (Cohen, Cohen, Aiken, & West, 2003). Yet... | <p>I don't know that I can give a rigorous theoretical explanation, but a picture may make things clearer:</p>
<p><a href="https://i.sstatic.net/rsFi2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rsFi2.png" alt="enter image description here"></a></p>
<ul>
<li>The blue line is the OLS fit, the gray l... | 17 |
linear regression | Multidimensional linear regression (not multiple linear regression) | https://stats.stackexchange.com/questions/612513/multidimensional-linear-regression-not-multiple-linear-regression | <p>Let <span class="math-container">$p$</span> be a positive integer and suppose that each observation in my data set is a length-<span class="math-container">$p$</span> multivariate normal vector, and I have <span class="math-container">$n$</span> (an integer) observations of the length-<span class="math-container">$... | <p>Much confusion can come from the too-frequent lack of distinction between "multivariate" and "multiple" regression. Although one might argue that "multivariate" can describe any situation with multiple variables, it's best current practice to restrict "multivariate" to situati... | 18 |
linear regression | Simple linear regression in multiple linear regression analysis | https://stats.stackexchange.com/questions/266596/simple-linear-regression-in-multiple-linear-regression-analysis | <p>I am doing a multiple linear regression analysis project, and my instructor told me that I shouldn't be fitting the simple linear regressions at all. Does that mean scatter plots and added variable plots and diagnostic plots do not matter for individual predictors? I know that I probably don't need to transform indi... | 19 | |
linear regression | Can we solve multiple linear regression using simple linear regression solver? | https://stats.stackexchange.com/questions/195199/can-we-solve-multiple-linear-regression-using-simple-linear-regression-solver | <p>Suppose I have a blackbox function that solves simple linear regression. Can I use this function to solve "multiple" linear regression?
The blackbox computes the slope and intercept in a simple linear regression model.</p>
| 20 | |
linear regression | Linear model vs. linear regression | https://stats.stackexchange.com/questions/129063/linear-model-vs-linear-regression | <p>I have a question that I find really confusing regarding linear modelling and linear regression. I have expectation regarding the way some dependent variable (DV) are going to evolve with an independent variable (IV).</p>
<p>In order to check for a relationship between IV and DV, on several participants, I just com... | <p>I don't know how do you define a "linear model" but in general this term is used as synonym for linear regression (e.g. on <a href="http://en.wikipedia.org/wiki/Linear_model" rel="nofollow">Wikipedia</a>). Also from your definition:</p>
<p>$$y = X\beta + \epsilon$$</p>
<p>it appears that this <em>is</em> linear re... | 21 |
linear regression | Hierarchical Linear Regression should always outperform Ordinary Linear Regression | https://stats.stackexchange.com/questions/337235/hierarchical-linear-regression-should-always-outperform-ordinary-linear-regressi | <p>I am building a hierarchical linear model with varying intercepts. It takes the form for each unit $i$ in group $j$:</p>
<p>$$y_{ij} = \alpha_j + \beta_1 x_{ij,1} + \beta_2 x_{ij,2} \quad (1) $$</p>
<p>I am developing this hierarchical linear model using a complete Bayesian Analysis using stan. In stan, I am using... | 22 | |
linear regression | Kernelize Linear Regression | https://stats.stackexchange.com/questions/388403/kernelize-linear-regression | <p>We can kernelize Ridge regression as shown in these notes: <a href="https://www.ics.uci.edu/~welling/classnotes/papers_class/Kernel-Ridge.pdf" rel="nofollow noreferrer">https://www.ics.uci.edu/~welling/classnotes/papers_class/Kernel-Ridge.pdf</a>. </p>
<p>However would it be possible to find a vector <span class="m... | <p>I'm assuming that by "linear regression" you mean unregularized linear regression, i.e. ordinary least squares. In that case, then yes, sure: this is just ridge regression with <span class="math-container">$\lambda = 0$</span>. If the kernel matrix <span class="math-container">$K$</span> is invertible, then everythi... | 23 |
linear regression | linear regression after rotation | https://stats.stackexchange.com/questions/193723/linear-regression-after-rotation | <p>I have a set of 2 dimensional points [x,y], with a barycenter in 0,0 and I'm rotating it.</p>
<p>I'm wondering why the linear regression of this set of points is not rotating of the same amplitude.</p>
<p>Below is a sample python code :</p>
<pre><code>#creating a vector with a barycenter in 0,0
vecta=myData-baryc... | 24 | |
linear regression | Non Linear Regression -Regression Trees | https://stats.stackexchange.com/questions/175103/non-linear-regression-regression-trees | <p>For datasets of higher dimensions, how do I decide if a Linear model is sufficient to fit the data or if I have to use non linear models like regression trees to fit the data ? </p>
<p>NOTE:I did try both linear and non linear models to fit the data and observed that the mean squared error is substantively reduced ... | <p>Welcome to our site. Of course in regression problems like this (along with interpretability) our main goal is accuracy. Why are we afraid of going from linear models to more complex models, because by adding more parameters we may be over-fitting to our data.</p>
<p>Arguable the best way of dealing with this is ... | 25 |
linear regression | What does 'linear' word in multiple linear regression and linearity assumption in multiple linear regression mean? | https://stats.stackexchange.com/questions/621226/what-does-linear-word-in-multiple-linear-regression-and-linearity-assumption-i | <p>I am studying linear regression. I want to ask is the linear word in multiple linear regression refers to the linear relationship between the target variable and each of the regression coefficients b_0, b_1,b_2, ..., b_n? Also in multiple linear regression there is a linearity assumption does this assumption refers ... | 26 | |
linear regression | Best linear regression strategy | https://stats.stackexchange.com/questions/453277/best-linear-regression-strategy | <p>I have 11 variables (with 4 of them being sociodemographics) that predict my dependent variable. I want to perform linear regression analysis and I have two options. One: Exclude sociodemographics variables from regression analysis and just describe the participant's socidempgraphics in results and run simple linear... | <p>I don't know why including sociodemographics in a hierarchical linear regression gives you seven regression models. My very strong preference would be to fit the hierarchical linear model with demographics. But an equally strong preference would be to have a theory before I even looked at the data about which varia... | 27 |
linear regression | Linear and non-linear regression analysis | https://stats.stackexchange.com/questions/295550/linear-and-non-linear-regression-analysis | <p>I'm currently reading Maths and Stats for Web Analytics and Conversion Optimisation by Himanshu Sharma and noticed the following regarding regression analysis:</p>
<p>"If there is no or weak linear relationship between two variables or in other words the correlation between the two variables is zero or weak then th... | <p>The statement is at best misleading and at worst wrong and you don't need to go to nonlinear regression to prove it wrong. Here is the statement again:</p>
<blockquote>
<p>If there is no or weak linear relationship between two variables or in
other words the correlation between the two variables is zero or weak... | 28 |
linear regression | Linear regression, independent variable stationarity | https://stats.stackexchange.com/questions/319604/linear-regression-independent-variable-stationarity | <p>If we have classical linear regression model, and one of the regressors is time series (e.g. GDP), is it necessary for that variable to be stationary? Well i do not think so, because diversity in values yields to better results when we talk about linear regression, but I encounter different opinions.</p>
| <p>What you assume in a linear regression model is that the <em>error term</em> is a white noise process and, therefore, it must be stationary. There is no assumption that either the independent or dependant variables are stationary.</p>
<p>However, consider the following simple linear regression model for time series... | 29 |
linear regression | Time Series w/ Linear Regression | https://stats.stackexchange.com/questions/401771/time-series-w-linear-regression | <p>I have some time series data for prices that I'm trying to perform linear regression on. However, I feel that what I'm doing is incorrect and was hoping someone could point me in the right direction.</p>
<p><em><strong>Background</strong></em></p>
<p>The overall background of what I'm doing is taking sentiment ana... | 30 | |
linear regression | Multivariate Weighted Linear Regression | https://stats.stackexchange.com/questions/52363/multivariate-weighted-linear-regression | <p>Very simple. I am looking for a package that does Multivariate Linear Regression with weights on the observations. Does anyone know of a package that does this? I am shocked that I have not been able to find any.</p>
<p><strong>NOTE:</strong> R does <em>NOT</em> do multivariate regression. The <code>lm()</code... | <p>Try package <a href="http://cran.r-project.org/web/packages/MRCE/MRCE.pdf" rel="nofollow">MRCE</a> in <a href="http://www.r-project.org/" rel="nofollow">R</a>. This is for "Multivariate regression with covariance estimation".</p>
| 31 |
linear regression | Linear Regression Model | https://stats.stackexchange.com/questions/185851/linear-regression-model | <p>Which of the following is NOT a linear regression model?</p>
<pre><code>A. y = w_0 + w_1 * x
B. y = w_0 + w_1 * (x^2)
C. y = w_0 + w_1 * log(x)
D. y = w_0 * w_1 + log(w_1) * x
</code></pre>
| <p>When we say "linear regression" we mean linearity in <em>parameters</em>, not <em>variables</em>. Therefore, <code>A</code>, <code>B</code> and <code>C</code> are linear (the parameters $w_0$ and $w_1$ enter the equations linearly) while <strong><code>D</code></strong> is not (the parameter $w_1$ enters in logarithm... | 32 |
linear regression | Understanding the Assumptions of Linear Regression – Confused About Linearity! | https://stats.stackexchange.com/questions/662056/understanding-the-assumptions-of-linear-regression-confused-about-linearity | <p>I was recently in an interview and the guy asked me what is the assumptions behind the linear regression, where I mentioned that linear regression assumes a linear relationship between X and Y. The interviewer then gave me the equation:</p>
<p>y=alpha1+alpha2∗x+alpha3∗x^2</p>
<p>I said this isn't linear since it inc... | <p>The interviewer is correct. OLS regression assumes, among other things, that the regression is linear <em>in the parameters</em>. That means that the parameters (<span class="math-container">$\beta$</span>) cannot be raised to powers, or part of trig functions, or whatever. So</p>
<p><span class="math-container">$$Y... | 33 |
linear regression | Linear regression correlation | https://stats.stackexchange.com/questions/268464/linear-regression-correlation | <p>In a linear regression with several variables, a variable has a positive regression coefficient if and only if its correlation with the response is positive. ¿(TRUE OR FALSE)?</p>
| <p>False - if theres enough positive correlation within the independent variables ($cor(X_i,X_j) > 0$), and they're all positively correlated with the dependent variable ($cor(Y,X_i) > 0$), you can have a situation where one variable has a positive $\beta$ and another has a negative one, especially if linear comb... | 34 |
linear regression | X on Y Linear regression | https://stats.stackexchange.com/questions/505423/x-on-y-linear-regression | <p>Basically in a research project I am looking at the linear regression between my independent variable: Government Stringency Index, and dependent real GDP growth.</p>
<p>One area I investigate assumes if real GDP growth is more precisely measured, switching my variables in linear regression; to x on y linear regress... | <p>For simple linear regression using Ordinary Least Squares, you are minimising the sum of squares of the vertical residuals, and the outlying point has much more influence on the red line than on the blue line. Flipping your chart round (below) so horizontal becomes vertical and vice versa makes this obvious, especi... | 35 |
linear regression | Log-linear regression vs. logistic regression | https://stats.stackexchange.com/questions/86720/log-linear-regression-vs-logistic-regression | <p>Can anyone provide a clear list of differences between log-linear regression and logistic regression? I understand the former is a simple linear regression model but I am not clear on when each should be used.</p>
| <p>The name is a bit of a misnomer. Log-linear models were traditionally used for the analysis of data in a contingency table format. While "count data" need not necessarily follow a Poisson distribution, the log-linear model is actually just a Poisson regression model. Hence the "log" name (Poisson regression models c... | 36 |
linear regression | Discrepancy between multiple linear regression & simple linear regression results - Which one do I report? | https://stats.stackexchange.com/questions/562126/discrepancy-between-multiple-linear-regression-simple-linear-regression-result | <p>I have a dependent variable followed by 3 independent variables that I am trying to fit the best model for (using R). Examples of my models are below:</p>
<pre><code>#Multiple linear regression
mod <- lm(y ~ x1 + x2 + x3, data = data)
#Simple linear regression
mod2 <- lm(y ~ x1, data = data)
mod3 <- lm(y ~... | <blockquote>
<p>If the multiple linear regression model is significant, then should that one be used in a report/paper rather than the simple linear regression models?</p>
</blockquote>
<p>Yes. With correlated predictor variables (as you seem to have) each correlated with outcome (as you show in your individual models)... | 37 |
linear regression | interpretation of Linear regression | https://stats.stackexchange.com/questions/422076/interpretation-of-linear-regression | <p>I was reading about linear regressions on wikipedia and came across the <a href="https://en.wikipedia.org/wiki/Mean_and_predicted_response#Predicted_response" rel="nofollow noreferrer">mean and predicted response</a>. I just wanted to clarify somethings. So suppose we have a simple linear regression model, is the re... | <p>The predicted mean response at <span class="math-container">$x_i$</span> (the estimated conditional expectation of <span class="math-container">$y_i$</span>, <span class="math-container">$E(y_i|x=x_i)$</span> would be of the form <span class="math-container">$\hat{\alpha} + \hat{\beta} x_i$</span>. This is sometimes... | 38 |
linear regression | regression tree vs linear regression | https://stats.stackexchange.com/questions/408857/regression-tree-vs-linear-regression | <p>I'm using one explanatory variable in a regression tree and in a linear regression. The tree finds a split (with variance reduction splitting rule), though R2 is pretty small (0.2). On the validation data the model is confirmed. On the other hand the linear regression shows no relation (not even with 2nd order polyn... | <p>Just because there is no <em>linear</em> relationship between the variables does not mean that the pattern is "non-existing". Here is a simple example (using R).</p>
<pre><code>set.seed(1)
x = runif(100, 0, 5)
y = ifelse(x<1, 0, ifelse(x<2, 1, ifelse(x<3,0, ifelse(x<4,1,0))))
plot(x,y, pch=20)
</code></... | 39 |
linear regression | KNN-regression vs Linear regression | https://stats.stackexchange.com/questions/646366/knn-regression-vs-linear-regression | <p>Is there any assumption on data or any number of k, that makes kNN-regression equivalent to linear regression?</p>
| 40 | |
linear regression | How $R^2$ values in simple linear regression bound $R^2$ in multiple linear regression | https://stats.stackexchange.com/questions/268314/how-r2-values-in-simple-linear-regression-bound-r2-in-multiple-linear-regr | <p>A simple linear regression on x1 and y yields R^2 of 0.2</p>
<p>A simple linear regression on x2 and y yields R^2 of 0.1</p>
<p>What is a upper and lower bound of R^2 if we do a multiple linear regression on x1, x2 and y?</p>
<p>My guess on the lower bound is 0.2 if x1 and x2 are perfectly correlated, but is the ... | 41 | |
linear regression | Introduction to linear regression | https://stats.stackexchange.com/questions/254763/introduction-to-linear-regression | <p>As part of my work (programmer), I need to learn some linear regression. I have a degree in pure mathematics, but not in statistics. Could anyone be able to give me a good book, an introduction, in linear regression?</p>
<p>Thanks in advance!</p>
| <p>Linear regression is one of the core topics in statistics and hence should get some coverage in any introductory statistics textbook.</p>
<p>Gelman and Hill's <em>Data Analysis Using Regression and Multilevel/Hierarchical Models</em> is a well-respected textbook on regression that includes an early chapter with an ... | 42 |
linear regression | linear regression | https://stats.stackexchange.com/questions/124208/linear-regression | <p>I am reading a paper and come across the following information:</p>
<pre><code> Predictor Dependent Variable R Square Beta P
A D .12 .35 <0.05
B D .16 .40 <0.05
C D .13 .36 ... | <p>The significance of the correlation between y and x is related to the significance of the coefficient in the regression of y on x. </p>
<p>Specifically, for the <a href="http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#Testing_using_Student.27s_t-distribution" rel="nofollow">usual t-test<... | 43 |
linear regression | What is the difference between 'regular' linear regression and deep learning linear regression? | https://stats.stackexchange.com/questions/253337/what-is-the-difference-between-regular-linear-regression-and-deep-learning-lin | <p>I want to know the difference between linear regression in a regular machine learning analysis and linear regression in "deep learning" setting. What algorithms are used for linear regression in deep learning setting.</p>
| <p>Assuming that by deep learning you meant more precisely neural networks: a vanilla fully connected feedforward neural network with only <em>linear activation functions</em> will perform linear regression, regardless of how many layers it has. One difference is that with a neural network one typically uses gradient ... | 44 |
linear regression | Deciding between a linear regression model or non-linear regression model | https://stats.stackexchange.com/questions/136564/deciding-between-a-linear-regression-model-or-non-linear-regression-model | <p>How should one decide between using a linear regression model or non-linear regression model?</p>
<p>My goal is to predict Y.</p>
<p>In case of simple $x$ and $y$ dataset I could easily decide which regression model should be used by plotting a scatter plot. </p>
<p>In case of multi-variant like $x_1,x_2,...x_n$ ... | <p>This is a realm of statistics called model selection. A lot of research is done in this area and there's no definitive and easy answer.</p>
<p>Let's assume you have <span class="math-container">$X_1, X_2$</span>, and <span class="math-container">$X_3$</span> and you want to know if you should include an <span class=... | 45 |
linear regression | Linear Regression Analysis | https://stats.stackexchange.com/questions/177371/linear-regression-analysis | <p>I am very new to linear regression analysis and I am trying to solve my first examples, most of the examples I have come across contained some tables and data where I could easily use the formulas I know and solve them. However, I have just come across an example that does not have much data and I have no idea where... | <p>Simple illustration to know why the linear regression in this case does not work , and what is the logistic regression .</p>
<p>First of all , you have to know that your dependent variable $y$ (child becomes bullied ) is a binary variable , that means it takes two outcomes either Yes (becomes bullied ) or No (does ... | 46 |
linear regression | What are the differences between the linear regression and multiple linear regression? | https://stats.stackexchange.com/questions/83747/what-are-the-differences-between-the-linear-regression-and-multiple-linear-regre | <p>I'm interested to know that, what is the difference between linear regression and multiple linear regression? both of them seems same to me.</p>
| <p>By linear regression I assume that you mean simple linear regression. The difference is in the number of independent explanatory variables you use to model your dependent variable.</p>
<p>Simple linear regression</p>
<p>$Y=\beta X+\beta_0$</p>
<p>Multiple linear regression</p>
<p>$Y=\beta_1 X_1+\beta_2 X_2+...+ ... | 47 |
linear regression | Logistic vs linear regression | https://stats.stackexchange.com/questions/44569/logistic-vs-linear-regression | <p>Let's say I run a linear regression model with a binary dependent variable. If I ran logistic regression on the same data would the results be comparable or exactly similar? By results I mean both the beta values and the value of dependent variable. If not why? Also what can I say about linear regression being a sub... | <p>Neither method is a subset of the other. Suppose you have response variable $Y$ using covariates $X$. In linear regression, you assume that $E[Y|X]$ is linear in the parameters $\beta$, whereas in logistic regression you assume the log-odds,</p>
<p>$$
\log\Bigg(\frac{P(Y=1|X)}{P(Y=0|X)}\Bigg)
$$</p>
<p>is linear ... | 48 |
linear regression | When to use Simple Linear Regression over Multiple Linear Regression | https://stats.stackexchange.com/questions/535464/when-to-use-simple-linear-regression-over-multiple-linear-regression | <p>I am fairly new to the world of statistics and approaching it as I learn more about machine learning. I have a fairly firm grasp on regression analysis so far but not necessarily on nuances and best practices of application.</p>
<p>For example; assume I have 5 predictor variables—a clear case for consideration of mu... | <p>If you care about prediction, then you want the model that will maximize your out of sample predictive accuracy. The best way is to have a sense, in advance, of what variables will do that (e.g., all, some, or just one of your variables), and then fit that model. Often, people don't. In such a case, you can use a... | 49 |
linear regression | Simple or multiple linear regression | https://stats.stackexchange.com/questions/547330/simple-or-multiple-linear-regression | <p>If you were testing the hypothesis that age would have an effect on your dv for men, but not for women, would you measure this by doing a multiple linear regression with sex and age as the predictors for your DV or by splitting the data into male/female scores and then doing a simple linear regression with age as yo... | 50 | |
linear regression | Multiple Linear Regression coefficents | https://stats.stackexchange.com/questions/145949/multiple-linear-regression-coefficents | <p>I'm doing a linear regression, in R. The values are like this -</p>
<pre><code>u <- c(1,2,3,4,5,6,7,8,9,10)
v <- c(21,22,23,24,25,26,27,28,29,30)
w <- c(41,42,43,44,45,46,47,48,49,50)
y <- c(128.2305,132.4040,140.1732,147.3236, 154.5410, 158.7206, 165.1761, 169.7121,178.9751,181.0309)
</code></pre>
<... | <p>Two of your three regressors ($v$ and $w$, say) are linear combinations of the intercept column (the "1"-vector) and the third regressor ($u$, say), thus causing "perfect multicollinearity". For instance, the vector $v$ equals $u$ plus 20.</p>
<p>Technically speaking, the design matrix $X$ with rows
$$
X_{i,.} = ... | 51 |
linear regression | Linear Regression Variable Selection | https://stats.stackexchange.com/questions/548572/linear-regression-variable-selection | <p>##Linear Regression Variable Selection</p>
<p>Hi I am running a simple single variable linear regression model where covid deaths per 100,000 are my dependent variable and my independent variable is % of population with iron deficiency. Does it make sense to regress these two variables together or should I be align... | <blockquote>
<p>or should I be aligning my data and make iron deficiency per 100,000?</p>
</blockquote>
<p>No, this is a bad idea. In that case you will have the response and the regressor <em>both</em> divided by the same variable - population - which will invoke bias due to mathematical coupling.</p>
| 52 |
linear regression | Hacking linear regression | https://stats.stackexchange.com/questions/491194/hacking-linear-regression | <p>Let's say I perform linear regression on some data that produces the following <span class="math-container">$R^2$</span>:</p>
<p><span class="math-container">$\text{RSS} = 1966815.13$</span></p>
<p><span class="math-container">$\text{TSS} = 2145213.91$</span></p>
<p><span class="math-container">$R^2 = 0.083$</span>... | <h2>You decreased the (total) variance in the data making it easier to explain.</h2>
<p>Thanks to the same <span class="math-container">$y$</span>-axis limits, it can be easily seen that the data of your first example is much more spread in this direction than in the <span class="math-container">$x$</span>-axis directi... | 53 |
linear regression | Linear regression cost function | https://stats.stackexchange.com/questions/561349/linear-regression-cost-function | <p>I'm looking at plain linear regression was wondering about the specifics of the cost function.</p>
<blockquote>
<p>The cost function associated with simple linear regression is given by:</p>
<p><span class="math-container">$$J(\theta) = \frac{1}{2n}\sum_{1=1}^n(y_i - \theta^tx_i)^2$$</span></p>
</blockquote>
<p>Wher... | <p><a href="https://en.wikipedia.org/wiki/Linear_regression" rel="nofollow noreferrer">Linear regression</a> minimizes squared error</p>
<p><span class="math-container">$$
J(\theta) = \sum_{i=1}^n (y_i - \theta^T x_i)^2
$$</span></p>
<p>You might want to put <span class="math-container">$1/n$</span> in front, so that i... | 54 |
linear regression | Linear regression for classification | https://stats.stackexchange.com/questions/129571/linear-regression-for-classification | <p>Suppose, I have a classification problem with 2 classes (0 and 1) and evaluation criteria is AUC. I used the following method: fit a linear regression and then pass its predictions through the logistic function.
As far as I understand, it is not equivalent to logistic regression, because estimates of coefficients w... | <p>This is not outrageous.</p>
<p>The logistic regression aims to minimize log loss, <span class="math-container">$L(y,\hat y) = -\sum\bigg[y_i\log(\hat y_i) + (1 - y_i)\log(1 -\hat y_i)
\bigg]$</span>.</p>
<p>Whatever your OLS-based model does, the competing logistic regression is not trying to optimize your metric of... | 55 |
linear regression | Coefficient for linear and non-linear regression | https://stats.stackexchange.com/questions/506491/coefficient-for-linear-and-non-linear-regression | <p>I have used a deep NN for performing regression analysis with multiple independent variables and then predicting one dependent varible.</p>
<p>To understand the quality of the regression I have used <span class="math-container">$R^2$</span>, but it is typically used for linear regression.</p>
<p>My question is, Can ... | <p>R2 can be used. Also you can check all the loss functions used in regression settings, such as MSE (mean squares error) MAE (mean absolute error) etc.</p>
| 56 |
linear regression | Homoscedasticity assumption in simple linear regression | https://stats.stackexchange.com/questions/336101/homoscedasticity-assumption-in-simple-linear-regression | <p>What do you mean by a distribution is homoscedastic (i.e. $ σ(Y|X = x) = σ$) in the context of simple linear regression?</p>
<p>Why do we need this assumption in simple linear regression?</p>
<p>What will happen to the regression if a distribution is not homoscedastic?</p>
| <p>When you perform a regression, you are making assumptions about the distributions of the random variables whose outcome you have observed. Those observations are your data.</p>
<p>Homoscedasticity means that the distribution you assume is generating the $Y$ value of your data points has the same variance no matter ... | 57 |
linear regression | Linear Regression feature transformation | https://stats.stackexchange.com/questions/342731/linear-regression-feature-transformation | <p>One way of making linear regression applicable more widely is to use basis
expansions, i.e., adding more features to the input set. Suppose that the
data is described by a p-tuple, $(x_1 , x_2 , . . . , x_p )$. Comment on the utility of
the following sets of features. Specifically describe the family of functions
th... | <p>I hope I understood your question. The equation for linear regression (without the intercept) can be written as follows:
\begin{equation}
y_i=\beta_1x_{i,1}+\beta_2x_{i,2}+…+\beta_{p}x_{i,p}+\epsilon_i.
\end{equation}
For $(a)$ using the transformation $x_i=x_i+(x_i * x_{i+1})$ and we get the following:
\begin{equat... | 58 |
linear regression | Plotting linear regression with factors | https://stats.stackexchange.com/questions/179498/plotting-linear-regression-with-factors | <p>I'm working on a project with R and I don't think I'm using the appropriate linear regression or plot, I've made both but they don't seem to match. The study is an ANOVA comparing $CO_2$ emissions per capita with 5 groups of income levels and a relevant linear regression. For the linear regression I want use $CO_2... | <p>When you use dummy variables, the coefficients don't represent slopes, they represent a constant number which is added to the estimate when the variable equals 1.</p>
<p>So your "High income: OECD" results from the linear regression are entirely consistent with the graph-- you can see on the graph that the High inc... | 59 |
linear regression | Linear Regression on non-stationary regressor | https://stats.stackexchange.com/questions/323866/linear-regression-on-non-stationary-regressor | <p>I am doing a linear regression and the regressors, like GDP, inflation, etc, (independent variables) are non-stationary.</p>
<p>What should I do if those regressors are not stationary? Should I 'make' it to stationary before regression?</p>
| 60 | |
linear regression | Linear regression and multicollinearity | https://stats.stackexchange.com/questions/405805/linear-regression-and-multicollinearity | <p>There is a multiple linear regression model being created.</p>
<p>Y=ax1+bx2+cx3</p>
<p>Following HYPOTHESES are formed</p>
<p>Variable x does not impact y</p>
<p>for all variables x1, x2 , x3 and so on.</p>
<p>We removed a variable , say , x2 because of high VIF value from regression model but that means it is ... | <p>Your hypotheses can only relate to one model. In your model with three predictors, you have three hypotheses. If you decide to remove one of the variables, the model changes, and you cannot compare hypotheses. In particular, there is no sensible hypothesis for <span class="math-container">$x_2$</span> anymore, but a... | 61 |
linear regression | Difference between kernel linear regression and non-parametric regression | https://stats.stackexchange.com/questions/546954/difference-between-kernel-linear-regression-and-non-parametric-regression | <p>A quick perplexity popped up in my mind while reading about <em>non-parametric</em> linear regression.</p>
<p>In linear regression, we model our response <span class="math-container">$\textbf{y} \sim \mathcal{N}(X\beta, \sigma^2I)$</span> so basically we try to estimate a linear function of the form</p>
<p><span cla... | <p>A <em>parametric model</em> has fixed number of parameters, in case of <a href="https://stats.stackexchange.com/questions/268638/what-exactly-is-the-difference-between-a-parametric-and-non-parametric-model"><em>non-parametric model</em></a>, the number of parameters grows with the size of the data. What follows, wit... | 62 |
linear regression | R: Anova and Linear Regression | https://stats.stackexchange.com/questions/76250/r-anova-and-linear-regression | <p>I am new to statistics and I am trying to understand the difference between ANOVA and linear regression. I am using R to explore this. I read various articles about why ANOVA and regression are different but still the same and how the can be visualised etc. I think I am pretty there but one bit is still missing.</p>... | <blockquote>
<p>this looks like that actually the intercepts are compared and not the slopes?</p>
</blockquote>
<p>Your confusion there relates to the fact that you must be very careful to be clear about which intercepts and slopes you mean (intercept of what? slope of what?).</p>
<p>The role of a coefficient of a 0-1 ... | 63 |
linear regression | Scaling in linear regression | https://stats.stackexchange.com/questions/208341/scaling-in-linear-regression | <p>The text is from <a href="http://www.amazon.in/Introduction-Statistical-Learning-Applications-Statistics/dp/1461471370?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=b2873fcd-dac7-4d50-8a4f-ef395872fda3" rel="nofollow">Intro to Statistical Learning</a> Page no 380.Can anyone explain the both ideas cle... | <p>It does not matter for fitted values and residuals if we change the units of measurement of $X$. Consider transforming $X $ by some invertible $k\times k$ matrix $A$, $XA$ (e.g., change months of schooling to years and meters to centimeters when explaining wages).</p>
<p>This is seen as follows,
\begin{eqnarray*}
P... | 64 |
linear regression | Simple Linear Regression Question Confusion | https://stats.stackexchange.com/questions/545954/simple-linear-regression-question-confusion | <p><a href="https://i.sstatic.net/vLSB9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vLSB9.png" alt="enter image description here" /></a></p>
<p>By using <a href="https://www.socscistatistics.com/tests/regression/default.aspx" rel="nofollow noreferrer">this site</a> I found the two linear regression m... | <p>I think those equations are wrong. From equating them I get <span class="math-container">$x\approx-246$</span>.</p>
<p>I've copied the data from the chart into R:</p>
<pre class="lang-r prettyprint-override"><code>df <- tibble(
year = seq(1998, 2008, by = 2),
usa = c(44.23, 83.05, 169.57, 190.43, 206.49, 225.... | 65 |
linear regression | Why is a linear regression not linear when you plot it? | https://stats.stackexchange.com/questions/586864/why-is-a-linear-regression-not-linear-when-you-plot-it | <p>I can't find a proper explanation for my question on <em><a href="https://stats.stackexchange.com/tour">Cross Validated</a></em>. The closest explanation was <a href="https://medium.com/@biswajit3071976/what-does-the-term-linear-in-linear-regression-mean-97ef717bed7b" rel="nofollow noreferrer">this one</a> from <a h... | <p>Linear regression is "linear" in the sense of modeling the data with a <a href="https://en.wikipedia.org/wiki/Linear_function" rel="noreferrer">linear function</a>, i.e.</p>
<p><span class="math-container">$$
f(x) = a + b x
$$</span></p>
<p>If you put a sinusoid in place of <span class="math-container">$x$... | 66 |
linear regression | robust linear regression with interaction | https://stats.stackexchange.com/questions/641936/robust-linear-regression-with-interaction | <p>I am looking how epigenetic age associated with toxic element exposure in four different road buffer zone (1000m, 2000m, 3000m, &4000m) using robust linear regression. I can run robust linear regression without interaction term, but could you please help me how to run robust linear regression with interaction te... | <p>Let's run through the model parameters and <code>emmeans</code>. Your model itself will predict the mean epigenetic age given a set of predictor variables. I'm not so sure a normal approximation is necessarily best for such outcome, but let's side-step that for now.</p>
<p>For every categorical predictor you will ha... | 67 |
linear regression | Poisson regression VS log-linear regression VS linear regression with log transformation | https://stats.stackexchange.com/questions/554641/poisson-regression-vs-log-linear-regression-vs-linear-regression-with-log-transf | <p>Could someone explain the differences among the three? It looks to me the function form is the same so they're doing the same thing, but the potential assumption on Y distribution is different between 1 and 3. And I think 1 and 2 is exactly the same thing.</p>
<ol>
<li>Log Transformations on Y in a Linear Model</li>... | 68 | |
linear regression | Gauss-Markov assumptions for Multiple linear regression | https://stats.stackexchange.com/questions/493299/gauss-markov-assumptions-for-multiple-linear-regression | <p>Are the Gauss-Markov assumptions the same for Simple Linear Regression and Multiple Linear Regression? I cant seem to find the answer for this and my literature seem to suggest that they have different formulas.</p>
<p>(Literature: An introduction to Econometrics - James H. Stock, Mark W. Watson.)</p>
<p>These are ... | <p><strong>YES</strong></p>
<p>Simple linear regression is a special case of multiple linear regression that only has one feature (<span class="math-container">$x$</span> variable). Consequently, any theorem that applies to multiple linear regression must apply to simple linear regression, so, yes, the Gauss-Markov ass... | 69 |
linear regression | Using PCA vs Linear Regression | https://stats.stackexchange.com/questions/410516/using-pca-vs-linear-regression | <p>I'm looking to analyzing data from a study and previous studies that are similar have used either PCA or hierarchical linear regression to analyze the data. I've used both PCA and linear regression previously. From my understanding PCA breaks the data down into principal components and is useful for learning what f... | <p>PCA does not involve a dependent variable: All the variables are treated the same. It is primarily dimension reduction method. </p>
<p>Factor analysis also doesn't involve a dependent variable, but its goal is somewhat different: It is to uncover latent factors.</p>
<p>Some people use either the components or the ... | 70 |
linear regression | Correlated regressors in linear regression | https://stats.stackexchange.com/questions/358606/correlated-regressors-in-linear-regression | <p>I have a sample of 412 young subjects, measured twice in an interval between 20 days and 3 years.
I am interested in how two external factor (lets say sunlight and ice-cream) relates to growth. Subjects were exposed to sunlight and ice-cream somewhat randomly, and I have calculated the cumulative exposure (CE) as th... | <p>In short, yes. You're basically cherry-picking data to find an effect.</p>
<p>If you have significantly correlated predictors, you should consider removing some of them.</p>
| 71 |
linear regression | Is log-linear regression a generalized linear model? | https://stats.stackexchange.com/questions/330412/is-log-linear-regression-a-generalized-linear-model | <p>Does log-linear regression fall into the class of generalized linear models? Here I'm defining "log-linear regression" as the model $\log(y) = x'\beta + \eta$ where $\eta \sim N(0, \sigma^2)$.</p>
<p>Thanks.</p>
| <p>Normally, loglinear models <em>for contingency tables</em> are considered as generalized linear models (Fox 2016). They are sometimes called Poisson regression for contingency tables (Bilder & Loughlin 2015). In the case of Poisson regression, we have a response random variable $Y$, and $p \geq 1$ explanatory va... | 72 |
linear regression | Linear regression parameters question | https://stats.stackexchange.com/questions/60094/linear-regression-parameters-question | <p>Are the slope and intercept of a simple linear regression model always normally distributed? </p>
<p>Is there ever a difference between the distribution of the estimated slope and intercept and the actual ones? </p>
<p>I have only just begun learning about the subject but I am still not clear on the details. </p>
... | <blockquote>
<p>Are the slope and intercept of a simple linear regression model always normally distributed?</p>
</blockquote>
<p>No. If the data ($y$'s) are (conditionally) normal and the other assumptions hold, they will be, and you can get asymptotic normality under some conditions, but generally, no.</p>
<block... | 73 |
linear regression | Linear regression Vs Logistic regression | https://stats.stackexchange.com/questions/201299/linear-regression-vs-logistic-regression | <p>I have a time series dataset. The,</p>
<p>X (Independent variable) is time and is denoted as 1,2,3,4,5,6..1000.etc
Y (Dependent variable ) is a percentage scale as 99%, 98.7%, 96%, 91% ...etc. This is a continuous data set. </p>
<p>I have 1000 such data points. The first 700 data points used as training set and re... | <p>You're correct that logistic regression is only for binary response data, which is not applicable here. What you may be wanting to do is simply apply the <a href="https://en.wikipedia.org/wiki/Logit" rel="nofollow">logit</a> transform to the response data (i.e. the $Y$ values) and then use linear regression on the t... | 74 |
linear regression | Linear regression multicollinearity | https://stats.stackexchange.com/questions/146694/linear-regression-multicollinearity | <p>I run linear regression with Posttest scores as DV and Pretest scores and Group as IVs.
Collinearity Statistics Tolerance shows .998 both for Pretest and Group (VIF 1.002).
Is this one of the situations where violating Collinearity might be ignored?</p>
| <p>I think you are misinterpreting what tolerance means. Much like in real life, in statistics you <em>want</em> high tolerance. Tolerance is $1-R^2$ where $R^2$ is the squared correlation of the two variables being compared (in your case pretest scores and group assignment). Thus, .998 means there is <em>almost no mul... | 75 |
linear regression | Linear Regression with Bootstrapping | https://stats.stackexchange.com/questions/341880/linear-regression-with-bootstrapping | <p>I wish to run a linear regression model, with a dependent variable Y and several explanatory variables.</p>
<p>The distribution of Y looks like this:</p>
<p><a href="https://i.sstatic.net/g6JZZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/g6JZZ.png" alt="enter image description here"></a> </p>
<... | <ol>
<li><p>Linear regression does <strong>not</strong> require a normally distributed dependent variable, only the error term should be normally distributed ( but that is only important in small samples)</p></li>
<li><p>A bootstrap with outliers means that your estimates of the sampling distributions are going to be b... | 76 |
linear regression | Likelihood distribution for linear regression | https://stats.stackexchange.com/questions/328305/likelihood-distribution-for-linear-regression | <p>I am reading <a href="https://www.crcpress.com/Statistical-Rethinking-A-Bayesian-Course-with-Examples-in-R-and-Stan/McElreath/p/book/9781482253443" rel="nofollow noreferrer">Statistical Rethinking (Section 4.2)</a>.</p>
<p>When defining the components of a model description the author says:</p>
<blockquote>
<p>... w... | <p><a href="https://i.sstatic.net/ybpuA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ybpuA.png" alt="enter image description here"></a></p>
<p>This image gives a good probabilistic interpretation for Linear regression. We want the mean of the residual (fancy word for error) at every point on our line... | 77 |
linear regression | Using several linear regression | https://stats.stackexchange.com/questions/117838/using-several-linear-regression | <p>I am currently trying to build an algorithm to predict a continuous output (Y) from a list of predictors (X). My first idea was to use a simple linear regression to see how it performs. Distribution of residual errors is not normal.</p>
<p>I have a lot of data and I was wondering if I can take advantage to this to ... | <p>If the distribution of the residuals are not normal, then you might want to consider other methods since the predictions and confidence intervals are likely to be misleading. Ease-of-computation doesn't seem like a good enough reason.</p>
<p>In terms of clock cycles, it's more expensive to create models than it is ... | 78 |
linear regression | Logistic vs linear regression difference | https://stats.stackexchange.com/questions/311591/logistic-vs-linear-regression-difference | <p>Can someone please differentiate logistic regression vs linear regression? I know that logistic regression is discrete (1, 0) and Linear regression is continuous. Could you provide two examples that set the two apart? Im just really confused on when to use which.</p>
| <p>You answered the question by yourself: linear regression is used for predicting continuous variables and logistic regression is used to predict binary variables. Here are some examples:</p>
<ul>
<li>Predict the price for a house in US dollar (a positive number): linear regression</li>
<li>Predict the if certain per... | 79 |
linear regression | Linear regression vs. Pearson's | https://stats.stackexchange.com/questions/397083/linear-regression-vs-pearsons | <p>I understand that linear regression is finding the "best fitting line" and Pearson's r is measuring correlation between two variables, but I can't visualize this difference.</p>
<p>I had a project where I was finding if certain brain cancers were correlated to age, or sex for example, and I was advised to use linea... | <p>Check out <a href="https://stats.stackexchange.com/questions/2125/whats-the-difference-between-correlation-and-simple-linear-regression">this previous post</a> to understand the differences/similarities between the two and how they are related.</p>
<p>I would assume the person advising you was implying that you sho... | 80 |
linear regression | Alternative to linear regression | https://stats.stackexchange.com/questions/223004/alternative-to-linear-regression | <p>I need to run hundreds of linear regression models, with the same set of independent variables, but with varying dependent variables. I have checked normality for a few dozens. Some are normally distributed and some are not. </p>
<p>My intention, for practical reasons, is to write a macro that will run this automat... | <p>There is a lot of misunderstandings here, mostly posted out in comments. So I will make a summary here.</p>
<ol>
<li>You should not use stepwise methods in any form, they lead to invalid inferences. Many question on this site about that, here is a good one: <a href="https://stats.stackexchange.com/questions/20836/... | 81 |
linear regression | Loss function of linear regression | https://stats.stackexchange.com/questions/380099/loss-function-of-linear-regression | <p>How do we decide whether mean absolute error or mean square error is better for linear regression? Are there other loss functions that are commonly used for linear regression?</p>
| <p>Put simply: it matters what error metric matters most to you. I have not personally seen a useful application of absolute error loss. In 99% of cases, people use squared error loss. Regression, by definition, is about modeling trend lines that approximate a mean response over a range of predictors. </p>
<p>If the C... | 82 |
linear regression | Linear regression analysis assumptions not met | https://stats.stackexchange.com/questions/463082/linear-regression-analysis-assumptions-not-met | <p>I want to demonstrate a possible association between a dichotomous independent variable and a continuous dependent variable. Therefore, I wanted to use a linear regression analysis. However, the dependent variable is not normally distributed, while normality is an assumption of linear regression analysis. The other ... | <p>You may transform the variable in several ways, in order to reduce skewness. For instance, you may take the log, square- or cube root of the variable. Which transformation will yield a most normal-like distribution depends on the nature of your data.</p>
<p>This is a useful article that explains some different appr... | 83 |
linear regression | Neural Network vs Linear regression | https://stats.stackexchange.com/questions/582202/neural-network-vs-linear-regression | <p>We know that the neural network will perform like a linear regression if there is only one hidden unit. So, the NN method should perform at least as well as a linear regression method. I have built a tidymodel model using the following line of code:</p>
<pre><code>Data_nnet_mod <- mlp(hidden_units = tune(), pen... | <p>A neural network with one hidden unit and linear activation <em>is</em> linear regression. There may be differences though, for example, neural networks are usually trained with variants of gradient descent, while linear regression with <a href="https://en.wikipedia.org/wiki/Ordinary_least_squares" rel="nofollow nor... | 84 |
linear regression | Correlation vs simple linear regression | https://stats.stackexchange.com/questions/473112/correlation-vs-simple-linear-regression | <p>Both correlation and linear regression explain the linearity in data but to get a high correlation coefficient the data must be linear with a slope close to 1. In some cases you can have linear data that can be fit on a regression line with a slope less than one, in which case the correlation coefficient will be low... | <p>Your conjecture that the correlation is only one for slope one is wrong, as you can easily test with data on a line with slope 0.5:</p>
<pre><code>cor(c(2,4,6), c(1,2,3))
</code></pre>
<p>This returns 1 because the correlation is 1 whenever all data points lie exactly on a line with slope greater than zero.</p>
| 85 |
linear regression | Efficient online linear regression | https://stats.stackexchange.com/questions/6920/efficient-online-linear-regression | <p>I'm analysing some data where I would like to perform ordinary linear regression, however this is not possible as I am dealing with an on-line setting with a continuous stream of input data (which will quickly get too large for memory) and need to update parameter estimates while this is being consumed. i.e. I canno... | <p>Maindonald describes a sequential method based on <a href="http://en.wikipedia.org/wiki/Givens_rotation" rel="noreferrer">Givens rotations</a>. (A Givens rotation is an orthogonal transformation of two vectors that zeros out a given entry in one of the vectors.) At the previous step you have decomposed the <a href... | 86 |
linear regression | Linear Regression coefficients through ANN | https://stats.stackexchange.com/questions/442294/linear-regression-coefficients-through-ann | <p>I am struggling to get ANN to estimate constant and coefficients of a linear regression problem. Unfortunately my results are way off from the expected. Kindy take a look at the reproducible code below.</p>
<pre><code>from sklearn import datasets
from sklearn.model_selection import train_test_split
X, y = sklearn.... | <p>Although more sophisticated optimizers do well in general for solving highly non-convex problems, using vanilla gradient descent may very well suffice for a convex one such as this (i.e. linear regression):</p>
<pre><code>model.compile(loss='mean_squared_error', optimizer='sgd')
</code></pre>
<p>A small touch on y... | 87 |
linear regression | correlation and simple linear regression | https://stats.stackexchange.com/questions/532147/correlation-and-simple-linear-regression | <p>what this sentence means"The correlation squared (r2 or R2) has special meaning in simple linear regression. It represents the proportion of variation in Y explained by X".</p>
| 88 | |
linear regression | Linear regression and arithmetic mean | https://stats.stackexchange.com/questions/43209/linear-regression-and-arithmetic-mean | <p>I do experiments with a certain parameter x. The result is y. I assume y is linearly related to x.</p>
<p>Suppose I can do 1000 experiments, which method will give me a better estimation of the linear relation?</p>
<ul>
<li>Select 1000 different values of x, get a single y for each x, and do linear regression?</li... | <p>I assume the question refers to the error on the parameter estimates. To assess the linear relationship between two variables x and y we use linear regression to estimate the two parameters intercept and slope. </p>
<p>It is easy to demonstrate that the last two options are identical, because during linear regressi... | 89 |
linear regression | Linear regression - minimum sample size | https://stats.stackexchange.com/questions/448977/linear-regression-minimum-sample-size | <p>I would like to perform a simple linear regression on data that shows a clear linear relationship.</p>
<p>How to determine the minimum sample size for a simple linear regression analysis?</p>
<p>My sample size is small, so even if the linear relationship is evident, I don't know how to determine if the sample size... | <p>Well, I suppose the <em>minimum</em> is 2. But it really depends on what the goal is. If all you want to do is hint at a linear relationship, you won't need many. If your goal is to perform a test of hypothesis that the coefficient for the slope of your line has a particular sign, you can do a sample size calcula... | 90 |
linear regression | Linear Regression and Quantile Regression | https://stats.stackexchange.com/questions/564642/linear-regression-and-quantile-regression | <p>Linear regression using the method of least squares estimates the conditional mean of the response variable across values of the predictor variables.</p>
<p>Quantile regression estimates a conditional quantile of the response variable across values of the predictor variables.</p>
<p>The least squares method minimise... | <p>What you have seems to be a fairly standard log-normal survival/reliability model of continuous-time failure data. You presumably didn't model quantiles directly, but rather the entire function describing <span class="math-container">$\log (T)$</span> as a function of covariates and time. The way you did this was wi... | 91 |
linear regression | Is classification using linear regression called logistic regression or linear disriminant analysis? | https://stats.stackexchange.com/questions/523340/is-classification-using-linear-regression-called-logistic-regression-or-linear-d | <p>I have heard people describe logistic regression as linear regression except as it is deployed for classification. But I have heard the exact same comment about LDA (linear discriminant analysis). Out of logistic regression and LDA, which is closer to what happens in linear regression?</p>
| <p>They are both close, but in different ways</p>
<ul>
<li>If you run ordinary least-squares regression with a binary class variable as the outcome (label) variable, you get exactly the 2-class case of linear discriminant analysis. So LDA (in the 2-class case) is linear regression run on a classification problem. It's ... | 92 |
linear regression | Support Vector Regression vs. Linear Regression | https://stats.stackexchange.com/questions/633091/support-vector-regression-vs-linear-regression | <p>I am new to ML and I am learning the different algorithms one can use to perform regression. Keep in mind that I have a strong mathematical background, but I am new in the ML field.</p>
<p>So I understand the math behind Support Vector Regression and behind Linear Regression. Now I just want to understand when is it... | <p>Contrary to popular belief (including beliefs implicit in <a href="https://stats.stackexchange.com/a/633112/247274">another answer</a>), linear regressions can handle extremely complicated relationships between variables, including curves and interactions. In that regard, a linear regression should be able to handle... | 93 |
linear regression | Exponentially weighted moving linear regression | https://stats.stackexchange.com/questions/9931/exponentially-weighted-moving-linear-regression | <p>I have a problem where I need to calculate linear regression as samples come in. Is there a formula that I can use to get the exponentially weighted moving linear regression? Not sure if that's what you would call it though.</p>
| <p>Sounds like what you want to do is a two-stage model. First transform your data into exponentially smoothed form using a specified smoothing factor, and then input the transformed data into your linear regression formula.</p>
<p><a href="http://www.jstor.org/pss/2627674" rel="noreferrer">http://www.jstor.org/pss/2... | 94 |
linear regression | Linear Regression Prediction vs Extrapolation Prediction | https://stats.stackexchange.com/questions/208259/linear-regression-prediction-vs-extrapolation-prediction | <p>Suppose we observe $x$ and $y$ and we want to predict at $x=5$. A naive way would be to take each observation and compute $5/(x/y)$ or similarly $5*(y/x)$ and then take the overall mean. Thi is basically rescaling each observation to the unit scale and then extrapolating to 5.</p>
<p>A more sophisticated approach... | <p>Yes, there is. We are modeling using $y = \theta x$. consider a simple example:
$(1,2), (3,3)$</p>
<p>Using naive, we are taking the average of $\frac{y}{x}$ for all data points as $\theta$ (see below for mathematical explantion). We have: $$\theta_{naive} = (1/2)(2+1) = 1.5$$</p>
<p>Using LR, we have $$ \theta_{L... | 95 |
linear regression | Linear Factor Model vs. Linear Regression Model | https://stats.stackexchange.com/questions/111231/linear-factor-model-vs-linear-regression-model | <p>I've been reading some literature that discusses 'linear factor models' which appear to describe the general equation often used in OLS regression. When people refer to a 'linear regression model' are they essentially just referring to a linear factor model? Where does the term linear factor model fit in in statis... | <p>Until now, I've only heard of linear regression models(LRM) as opposed to linear factor models(LFM). It looks like these are interchangeable terms, though different uses of the word 'factor' can be misleading here.</p>
<p>Here's two links calling the same generic form of the model by different names:</p>
<p>Factor... | 96 |
linear regression | Linear Regression to detect between a linear and non-linear trend | https://stats.stackexchange.com/questions/194236/linear-regression-to-detect-between-a-linear-and-non-linear-trend | <p>I have measured the area of spread of a number of plants through time. I'm interested in trying to ascertain whether a linear or a non-linear relationship (i.e. quadratic) best represents the increase in the sqrt of the area occupied by these plants through time </p>
<p>My first feeling was that I could use a linea... | <p>Consider your linear model
$$
y_t = a + bt + e_t
$$
where $e_t$ is the error term at time $t$.</p>
<p>If you took the difference
$$
y_t - y_{t-1} = a + bt + e_t -a - b(t-1) - e_{t-1} = b + e_t - e_{t-1}
$$
which is an integrated moving average model (ARIMA(0,1,1)) model. You can write it as </p>
<p>$$
\Delta y_... | 97 |
linear regression | Is the equation is Linear Regression? | https://stats.stackexchange.com/questions/397287/is-the-equation-is-linear-regression | <p>Employees Salary = 3000 + x(Employee Age)^2,
is this a Linear Regression?</p>
| <p>First, for there being a regression, there should be parameters! I will assume 3000 and 1 are in this case</p>
<p>It is linear regression if you consider your "employee age squared" as a variable, so, strictly speaking, it is a linear regression only after a transformation.</p>
<p>In general, there are many ways t... | 98 |
linear regression | Linear regression forecast underestimation | https://stats.stackexchange.com/questions/27700/linear-regression-forecast-underestimation | <p>I have the following multiple linear regression model:</p>
<pre><code>Call:
lm(formula = Y ~ X1 + X2 + X2 + X3 + X4 + X5 + X6 + X7,
data = my.model, na.action = na.omit)
Residuals:
Min 1Q Median 3Q Max
-43.836 -1.507 0.010 1.485 46.231
Coefficients:
Estimate Std. Err... | <p>The variance of predictions is always going to be less than the variance of the observations. The predictions are estimates of the means of the distributions conditional on the predictors. So, assuming the mean of the data is not too far from zero, you are comparing the dispersion of the means with the dispersion of... | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.