Most voted "regression" questions
Regression analyses are statistical techniques for modeling and predicting one or multiple variables based on other data. Use this tag for regression questions.
Learn more…68 questions
Sort by count of
-
9
votes4
answers8280
viewsHow to put the regression line on a graph?
Suppose a linear regression model like the following: set.seed(1) x <- rnorm(100) y <- rnorm(100) + 2*x +10 modelo <- lm(y~x) If I plot y against x, how do I include the regression line in…
-
7
votes3
answers3287
viewsHow to put the regression equation on a graph?
On another question saw how to put the regression line on a graph. But, how to put the regression equation in the graph? For example: Or…
-
6
votes1
answer219
viewsStargazer changing position of dependent variable
Considering the quantile regressions. library(quantreg) > x=rnorm(100,12,2) > y=rnorm(100,0,4) a<-rq(y~x,tau = .10) b<-rq(y~x,tau = .15) c<-rq(y~x,tau = .20) d<-rq(y~x,tau = .25)…
-
5
votes1
answer3442
viewsHow to plot the estimated logistic regression model
Suppose I have the data below, apply a logistic regression to them and want to visualize the estimated function that returns the probability. #Simula os dados nobs<-100 beta0=-10 beta1=0.006…
-
5
votes3
answers530
viewsHow to select all data.frame variables at once for a regression?
Suppose the following data.frame: set.seed(1) dados <- data.frame(y=rnorm(100), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100), x4=rnorm(100)) If I want to run a y regression against x1...xn, I can…
-
4
votes3
answers180
viewsHow to include a variable high to n in regression
Suppose I have the following data x<-rnorm(100,1,10000) y<-rnorm(100,1,10000)+2*x+x^2 If I use the lm function as follows: model1<-lm(y~x+x^2) The R does not understand that it is to place…
-
4
votes2
answers3369
viewsHow to do Multiple Linear Regression?
-- Rephrased question -- I have the following code mdl = LinearModel.fit(X_train,y_train); pred = predict(mdl,X_test); in which X_train is a matrix [m x n] with m examples and n Features (past time…
-
4
votes1
answer113
viewsUse regression residues to calculate another regression (within the function) in R
I’m using a function to calculate regressions. I need the residues of a specific relation to relate to another variable. However I need the waste to be calculated according to Facet grid. Thus, for…
-
4
votes1
answer244
viewsData Frame and Linear Regression
With this data frame I need to run some regressions. I want to make regressions with terms raised to 3 and lagged. I looked in the lm package and could not implement. I want for example to rotate…
-
4
votes1
answer1978
viewsProblem with forecast in R
I’m trying to make a relatively simple GDP forecast, but I’m finding the following mistake: **Error in model.frame.default(formula = y ~ t2, drop.unused.levels = TRUE) : comprimentos das variáveis…
-
3
votes2
answers3673
viewsLinear regression with python
I need to do the linear regression calculation, but I read that there is no possibility to use/install scipy in windows. Is there any other scipy-like library to perform this kind of calculation? Or…
-
3
votes1
answer428
viewsWeighted linear regression using the inverse of variance as the weighting factor
I have the following data set that establishes a relationship between two variables "X" and "Y": df <- data.frame(X=c(25,25,25,25,25,25,50,50,50,50,50,50,…
-
3
votes1
answer240
viewsLinear regressions in IHD with subdivided plot
Hello, good afternoon! would you like to know, how to perform a linear regression in dic with subdivided portion, detail I need the "Betas", because I intend to use the answer to predict a curve!…
-
3
votes2
answers490
viewsModify t test for linear regression parameters in R
I would like to know how I can change the t test in relation to the parameters of a linear regression in R. I would like to test whether B0 = 0 and whether B1 = 1. Generally, the output of a…
-
3
votes1
answer698
viewsInitial values in function nls in R
Hello, I have the following code in R temp<-c(10,12,14,15,17,20,22,23,25,26,28,29,30) taxa<-c(2,4.5,6.1,7.0,11,16,19,21,22,11,2,0.1,0.001) taxa<-taxa/9 plot(temp,taxa) df<-…
-
3
votes1
answer1025
viewsVariables selected in GLM being used in GLMM
I would like to ask a question about generalized mixed linear models. I know that the hierarchical structure of the observations, their independence and the existence of unbalanced samples among…
-
2
votes0
answers144
viewsReturn of the original scale in a prediction function
I created a simple function to perform prediction of tree heights through regression models built for this purpose (symmetric relation models). The function predicts the heights, and inserts them in…
-
2
votes0
answers61
viewsRegression vs Time Series problem Prediction problem
Long live. I would like to know the difference between a regression problem and a time series Prediction. I think regression is used to understand how independent variables interfere with the…
-
2
votes2
answers935
viewsHow to forecast future values of a time series?
I have values of a time series with a sampling every 5 minutes. How can I predict future values using only this information? How can I model something over a period of time and use it to predict the…
-
2
votes1
answer507
viewsSegmented Return in R
I was studying a little bit about regressão segmentada and some examples executed in R and I’m having doubts about the workings of segmented. I need to always define where the breaking points should…
-
2
votes1
answer78
viewsWhat is the alpha argument of the ltsReg function of the robustbase package?
I have a question about the use of the argument alpha of function ltsReg package robustbase. As I understand it, it is responsible for determining the size of the subsets that will be used to adjust…
-
2
votes1
answer162
viewsdifferent results using rpart and Caret
Hello, I’m testing some regression models and I don’t quite understand one thing: I used rpart from the rpart package, and then used Train with rpart method from the Caret package resultRPart <-…
-
2
votes1
answer309
viewsFunction Predict() does not accept exponential regression in R
Please try to perform a parametric modeling of survival analysis and function predict() is returning an error that does not recognize a variable, but it is there. Following example: base=NULL…
-
2
votes1
answer602
viewsMultiple Linear Regression in R in different groups
I have a data set, with 4 columns: Product - Site Price 1 - Concurrent Site Price - Quantities Sold Where Product is a specific product (Refrigerator 1, Refrigerator 2, etc); Price Website 1 is the…
-
2
votes2
answers452
viewsLinear Regression in Various Products
I ran a simple regression to a database with a product (Product, Volume, Price). It ran perfectly. But I would like to run the same regression on a basis with more products, but I want to be able to…
-
2
votes0
answers88
viewsNeural networks: how to adjust a line in the predicted values
I don’t know much about this world of artificial intelligence, but I have a data set that tends to be a linear function, and one thing I needed was to find the angular coefficient of the line that…
-
2
votes1
answer104
viewsLoop with dataframes in ordered logistic regression
I need to estimate an ordered logistic regression in which the database is divided into 417 dataframes giving a total of 33.7 GB. Merging all subsets into a single dataframe would make the option…
-
2
votes2
answers115
viewsRegression Graph in R or Python
It is possible to play this Regression graph in R or Python? Obs. This graph was produced using the Acquire 4 QAQC object. Link And this is the model I’ve created so far. dados =…
-
2
votes1
answer38
viewsWhy does the "nls" function of R not converge even with the initial curve very close to the points?
To adjust the following points with the function whose initial kick is represented by the line: But I get the following message: Error in nls(y ~ A * (1 + erf(E * B * (x - C)/sqrt(2))) * dnorm(B *…
-
2
votes1
answer181
viewsLinear Regression Evaluation and Graph Problem
My problem is that I can’t plot a line - first-degree function graph - in my first linear regression model. As a result, I have lines joining the scatter plot points of the training Features. I…
python-3.x matplotlib machine-learning regression sklearnasked 4 years, 2 months ago Breno Valle 23 -
2
votes1
answer36
viewsHeterocesarean mixed effects model via lmer function
I am adjusting a mixed effects model which due to observed heterocedasticity was necessary to include an effect to accommodate it. For this purpose, using the function lme package nlme this was easy…
-
2
votes1
answer39
viewsDiagnostic analysis in mixed effects models via Plot Half-Normal chart
I am intending to perform the Plot half-normal chart for a mixed effects model that has been adjusted using the package lme4. To visualize the diagnostic analysis of this model, I intend to use…
-
1
votes0
answers175
viewsANCOVA with curve homogeneity test
I’m doing some analysis of ANCOVA, but I don’t know if I’m not able to interpret the results. I understand that an ANCOVA would be an ANOVA along with regressions. But I need a test for homogeneity…
regressionasked 9 years, 8 months ago Joyce Maia 387 -
1
votes0
answers889
viewsHow to calculate r Squared (r 2) with the test examples?
I broke my dice into one set for training and another for testing. I would like to know if I can calculate the value of r 2 for the set of test examples. I created two models: one model with SVR and…
-
1
votes0
answers106
viewsIs ROC curve to GLMM possible?
Friends, My doubt is as follows, I am using the following code in R to construct a ROC curve , but I cannot say if in case of GLMM (Mixed Generalized Linear Model) I can use and if in this case the…
-
1
votes1
answer437
viewsScoring, Hessian and Newton Raphson function of the exponential distribution in R
How to find the score vector and the Hessian matrix in R to apply the Newton Raphson in the code below: rm(list=ls()) cat("\014") #Função para simular variáveis aleatórias de uma modelo de regressão…
-
1
votes1
answer143
viewsHow to make a linear regression in postgresql?
I wish to make a simple linear regression directly in the database. I noticed that postgresql already has some statistical functions, which seems to me to be for this purpose (regr_slope(Y, X),…
-
1
votes1
answer562
viewsA: singular gradient Matrix at initial Parameter estimates
When using the following command to estimate model parameters (bell_model): h <- c(43.34, 35.84, 33.45, 30.94, 27.35, 21.75, 13.75, 57.37, 48.36, 44.62, 41.05, 36.49, 29.92, 21.07, 66.65, 56.65,…
-
1
votes1
answer112
viewsLinear regression looping in r with alteration in the variable y
I’m doing a regression model Y ~ X1 + X2. Y are financial market shares (change in daily liquidity). X1 is a portfolio with the most traded shares (1st quartile), tb with the variation in daily…
-
1
votes0
answers46
viewsEstimates of ordinal regression with signal exchange
I am trying to reproduce the results that are in the book An Introduction to Generalized Linear Models third Edition of Dobson and Barnett, on page 161. The adjustment is an ordinal regression…
-
1
votes2
answers52
viewsR regression on same line data
I have the following data: mes <- c("jan","fev","mar","abr","maio","jun","ago","set","out") a <- c(32.3,32.7,32.6,33.1,33.0,33.5,33.4,33.4,34.9) b <-…
-
1
votes1
answer115
viewsHow to proceed non-linear regression by the mitscherlich model?
Hello, good afternoon! need to perform a nonlinear regression analysis nls(), and suggested me the mitscherlich model: I don’t know how to accomplish, I’d like your help! follows the example of the…
-
1
votes1
answer401
viewsHow to use a quadratic regression model?
I’m trying to learn how to adjust a quadratic regression model. The dataset can be downloaded at: https://filebin.net/ztr9har5nio7x78v Let Adjsaleprice be the target variable and…
-
1
votes1
answer62
viewsHow to adjust the regression line so that 90% of the lines are below the line?
I have the following data set in R: x <- c(0.1, 3, 4, 5, 9, 12, 13, 19, 22, 25) y <- c(5, 12, 17, 23, 28, 39, 26, 31, 38, 40) bd <- data.frame(x, y) My question is how I do in R to generate…
-
1
votes1
answer49
viewsProblems Adjusting Linear Regression in Stan
I’m having trouble adjusting a linear regression model in Stan. When observing the error message, note the identification in the part of the transformed parameters block. See below the structure of…
-
1
votes0
answers127
viewsPython - How to remove line in the middle of markers and additionally place trend line equation in Python
Good afternoon. I’m trying to create a graph in Python, in a Jupyter Notebook in Anaconda where I’d like to put the trend lines for each of the lines and the linear regression equation. I was able…
-
1
votes1
answer37
viewsAdjusted regression line considering different factors in ggplot2
I’m trying to reproduce the graph below, where the internal lines are the adjusted regression lines: However, for some factor is not being plotted what should, ie, is being presented a single line,…
-
1
votes2
answers62
viewsMixed effects model residue plots using ggplot2
I am trying to perform the residue graph of the mixed effects model by means of the ggplot2 function. However, after performing a search I found some available functions but what seems to me is that…
-
1
votes1
answer65
viewshalf-normal waste graph Plots no ggplot2
I am trying to realize the graph presented below regarding the residues in the half-normal Plot in ggplot2. However, I am facing an error entitled Error: data must be a data frame, or other Object…
-
1
votes1
answer92
viewsOverlay graphics in ggplot2 considering adjusted lines
I am trying to superimpose two graphs made in ggplot2, in which the first contains the line adjusted by means of a polynomial model of degree 2 and the other contains the adjusted lines of a model…