FAQ Database Discussion Community

## Getting statsmodels to use heteroskedasticity corrected standard errors in coefficient t-tests

python,regression,statsmodels
I've been digging into the API of statsmodels.regression.linear_model.RegressionResults and have found how to retrieve different flavors of heteroskedasticity corrected standard errors (via properties like HC0_se, etc.) However, I can't quite figure out how to get the t-tests on the coefficients to use these corrected standard errors. Is there a way...

## Regression gives error on one of the input variables “contrasts can be applied only to factors with 2 or more levels”

r,regression,categorical-data
I am running a logit regression in R with a large number of input variables. newlogit <- glm(install. ~ SIZES + GROSSCONSUMPTION.... + NETTCONSUMPTION..... + NETTGENERATION....... + GROSSGENERATION.... + Variable. + Fixed + Cost.of.gross.cons + Cost.of.net.cons + Cons.savings + generation.gains + Total.savings + Cost.of.system + Payback + Self.consumption + Total.consumption.as.solar...

## Multiple regressions with subsets of data using dplyr in R

r,regression,dplyr

## forward subset selection in R without intercept

r,statistics,regression,regression-testing
Hey so I am developing a multiple regression model and using the forward subset selection method to reduce the number of parameters and using "mallows Cp" as a selection criterion. However this is an engineering problem and it does not make sense to have an intercept,, i.e. when all the...

## P values from fastbw regression function of rms package

r,regression,linear-regression,rms
I am trying fastbw function of rms package for backward regression as follows (using mtcars dataset): > mod = ols(mpg~am+vs+cyl+drat+wt+gear, mtcars) > mod Linear Regression Model ols(formula = mpg ~ am + vs + cyl + drat + wt + gear, data = mtcars) Model Likelihood Discrimination Ratio Test Indexes...

## How to find fourth and fifth regression coefficients in R?

r,regression
I would like to compute 5 regression coefficients.I searched thru Internet but I did not find anything for this. my data: y=c(2,13,0.4,5,8,10,13) x=c(2,13,0.004,5,8,1,13) z=c(2,3,0.004,15,8,10,1) normal equation: y=a1x+a2z+a3 x, z, independent variables, y is the dependent variable, and a1 a3, and a2 are the parameters of the model. normal fit for...

## Constrained high order polynomial regression

matlab,regression
I am doing some bone segmentation whereas the result of this segmentation is points placed in a circular pattern around this bone. However as it is taken using a qCT scan, there is quite a lot noise (from e.g. flesh) on the points that i have. So the overall problem...

## chaid regression tree to table conversion in r

r,packages,regression,decision-tree
I used the CHAID package from this link ..It gives me a chaid object which can be plotted..I want a decision table with each decision rule in a column instead of a decision tree. .But i dont understand how to access nodes and paths in this chaid object..Kindly help me.....

## How to find algo type(regression,classification) in Caret in R for all algos at once?

r,machine-learning,classification,regression,caret

## Modelling interactions with only a subset of the levels of a factor in R

regression,interaction
Let's first look at lm. I have a continuous explanatory $X$ and a factor $F$ modelling seasonal aspects (in the example 8 levels). Let $\beta$ denote the slope for $X$ then I want to model interactions of the slope with the factor. It is some kind of physical model thus...

## How do you use variables in a regression formula in R?

r,regression
How do you use a variable in a regression formula? For example, using the 'Animals' dataset (in MASS), the following works fine: data(Animals) model <- lm(body ~ brain, data = Animals) But what I want to do is: data(Animals) x <- "body" y <- "brain" model <- lm(x ~ y,...

## getting fitted lines with scatterplot matrix in r

r,regression,linear
How do I get a scatterplot matrix which will also show the fitted lines in each plot. I know how to use "abline" function with individual plots but don't know how to implement it in a scatterplot matrix

## R— repeating linear regression in a large dataset

r,regression
I'm an R newbie working with an annual time series dataset (named "timeseries"). The set has one column for year and another 600 columns with the yearly values for different locations ("L1," "L2", etc), e.g. similar to the following: Year L1 L2 L3 L4 1963 0.63 0.23 1.33 1.41 1964...

## Python stats.linregress syntax error

python,syntax,regression,linear
I am trying to calculate the regression of the x and y variables, trace_no and twwt, respectively. The variable are 151 x 1 arrays. The code is outputting a syntax error: File "./seabed_dip_correction.py", line 32 slope, intercept, r_value, p_value, std_err, Syy/Sxx = stats.linregress(trace_no,twtt) SyntaxError: can't assign to operator I have...

## How do I add a trendline with categories to HighCharts?

javascript,jquery,highcharts,regression

## Used Predict function on New Dataset with different Columns

r,regression,predict
Using "stackloss" data in R, I created a regression model as seen below: stackloss.lm = lm(stack.loss ~ Air.Flow + Water.Temp + Acid.Conc.,data=stackloss) stackloss.lm newdata = data.frame(Air.Flow=stackloss$Air.Flow, Water.Temp= stackloss$Water.Temp, Acid.Conc.=stackloss\$Acid.Conc.) Suppose I get a new data set and would need predict its "stack.loss" based on the previous model as seen below:...

## SciKit-learn for data driven regression of oscillating data

python,time-series,scikit-learn,regression,prediction
Long time lurker first time poster. I have data that roughly follows a y=sin(time) distribution, but also depends on other variables than time. In terms of correlations, since the target y-variable oscillates there is almost zero statistical correlation with time, but y obviously depends very strongly on time. The goal...