linear-regression Questions

2

I want to do a piecewise linear regression with one break point, where the 2nd half of the regression line has slope = 0. There are examples of how to do a piecewise linear regression, such as here...
Accusatorial asked 5/5, 2015 at 18:11

2

Solved

I'm plotting a logarithmic regression's line of best fit as well as the confidence intervals around that line. The code I'm using works well enough, except I'd rather that the confidence intervals ...
Tuning asked 26/11, 2016 at 18:30

1

Solved

I am trying to understand how R determines reference groups for interactions in a linear model. Consider the following: df <- structure(list(id = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L...
Cowbird asked 21/11, 2016 at 15:3

1

I have to fit a linear model with the same model matrix to multiple responses. This can be easily done in R by specifying the response as matrix instead of a vector. Computation is very fast in thi...
Alterant asked 8/3, 2013 at 9:58

1

Solved

This is my data frame: data <- structure(list(Y = c(NA, -1.793, -0.642, 1.189, -0.823, -1.715, 1.623, 0.964, 0.395, -3.736, -0.47, 2.366, 0.634, -0.701, -1.692, 0.155, 2.502, -2.292, 1.967,...
Ardie asked 15/11, 2016 at 17:16

1

Solved

As I understand, numpy.linalg.lstsq and sklearn.linear_model.LinearRegression both look for solutions x of the linear system Ax = y, that minimise the resdidual sum ||Ax - y||. But they don't give...
Zermatt asked 12/4, 2016 at 12:18

1

Solved

The Tikhonov (ridge) cost becomes equivalent to the least squares cost when the alpha parameter approaches zero. Everything on the scikit-learn docs about the subject indicates the same. Therefore ...

1

Solved

I have found some odd behavior with predict and the svyglm object from the survey package. If your newdata in predict has a factor/character with one level it spits out error: Error in `contrasts&...
Rectitude asked 7/11, 2016 at 19:1

1

Below is a linear model output for a dataset consisting of a response variable and three explanatory variables. How do I get the RSS of the original regression? Call: lm(formula = y ~ x1 + x2 + ...
Syllabi asked 7/11, 2016 at 0:51

1

I think I have a pretty reasonable idea on how to do go about accomplishing this, but I'm not 100% sure on all of the steps. This question is mostly intended as a sanity check to ensure that I'm do...
Eadwina asked 27/10, 2016 at 14:20

2

Solved

I am trying to run a mixed-effects model that predicts F2_difference with the rest of the columns as predictors, but I get an error message that says fixed-effect model matrix is rank deficient...
Glochidium asked 7/5, 2016 at 16:6

1

Solved

I am trying to write a function for solving multiple regression using QR decomposition. Input: y vector and X matrix; output: b, e, R^2. So far I`ve got this and am terribly stuck; I think I have m...
Bittern asked 25/10, 2016 at 22:20

1

Solved

I'm trying to write a functions for multiple regression analysis (y = Xb + e) using a singular value decomposition for matrices. y and X must be the input and regression coefficients vector b, the ...
Topless asked 25/10, 2016 at 21:31

1

Solved

Consider the following example inds <- c('var1','','var2','') model1 <- c(10.2,0.00,0.02,0.3) model2 <- c(11.2,0.01,0.02,0.023) df = df=data.frame(inds,model1,model2) df inds model1 mod...
Unpin asked 21/10, 2016 at 12:23

1

This question relates to a machine learning feature selection procedure. I have a large matrix of features - columns are the features of the subjects (rows): set.seed(1) features.mat <- matrix...
Mosesmosey asked 19/10, 2016 at 21:22

1

Solved

I am interested in calculating estimates and standard errors for linear combinations of coefficients after a linear regression in R. For example, suppose I have the regression and test: data(mtcar...
Investigate asked 19/10, 2016 at 0:20

1

Solved

I wanted to compute a simple regression using the lm and plain matrix algebra. However, my regression coefficients obtained from matrix algebra are only half of those obtained from using the lm and...
Endosteum asked 18/10, 2016 at 16:34

4

Solved

I am doing linear regression with multiple variables/features. I try to get thetas (coefficients) by using normal equation method (that uses matrix inverse), Numpy least-squares numpy.linalg.lstsq ...

2

Solved

I've used lm() to fit multiple regression models, for multiple (~1 million) response variables in R. Eg. allModels <- lm(t(responseVariablesMatrix ~ modelMatrix) This returns an object of cla...
Waves asked 6/3, 2013 at 17:55

2

Solved

I am running Ridge regression with the use of glmnet R package. I noticed that the coefficients I obtain from glmnet::glmnet function are different from those I get by computing coefficients by def...
Phidias asked 4/10, 2016 at 23:42

2

Solved

During coding, I need to change the dummy value assigned to a factor. However, the following code does not work. Any suggestion? test_mx= data.frame(a= c(T,T,T,F,F,F), b= c(1,1,1,0,0,0)) test_mx ...
Duester asked 1/10, 2016 at 2:28

1

Solved

Given two simple sets of data: head(training_set) x y 1 1 2.167512 2 2 4.684017 3 3 3.702477 4 4 9.417312 5 5 9.424831 6 6 13.090983 head(test_set) x y 1 1 2.068663 2 2 4.162103 3 3...
Moneymaker asked 1/10, 2016 at 21:33

1

Solved

I would like to fit a (very) high order regression to a set of data in R, however the poly() function has a limit of order 25. For this application I need an order on the range of 100 to 120. mod...
Nonlegal asked 1/10, 2016 at 4:49

1

Solved

I'm trying to learn QR decomposition, but can't figure out how to get the variance of beta_hat without resorting to traditional matrix calculations. I'm practising with the iris data set, and here'...
Iluminadailwain asked 19/9, 2016 at 8:50

1

I want the similar visualization as shown below using Bokeh. As I am new to Bokeh , I might be wondering is there any code that is as concise as the below one using Seaborn ? My main focus is how t...

© 2022 - 2024 — McMap. All rights reserved.