FAQ Database Discussion Community

## 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...

## Observation deleted due to missingness in R

r,regression
I am busy with a regression model in R and i have about 16 000 observations. One of these observations causes me to get the following error message, (1 observation deleted due to missingness) Is there a way in R so that i can identify this one observation?...

## Tidy approach to regression models, ideally with dplyr

r,regression,dplyr,lm
Reading the documentation for do() in dplyr, I've been impressed by the ability to create regression models for groups of data and was wondering whether it would be possible to replicate it using different independent variables rather than groups of data. So far I've tried require(dplyr) data(mtcars) models <- data.frame(var...

## Getting coefficient at best lambda in glmnet in R

r,lambda,regression,glmnet

## 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...

## How to fit an elliptic cone to a set of data?

matlab,regression,curve-fitting,ellipse,best-fit-curve
I have a set of 3d data (300 points) that create a surface which looks like two cones or ellipsoids connected to each other. I want a way to find the equation of a best fit ellipsoid or cone to this dataset. The regression method is not important, the easier...

## 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 to plot a scatter plot with error bars indicating standard deviation

matlab,statistics,regression
I have a set of data Y v/s X (~20k data points) which when plotted are a scatter. I want to plot error bars for Y for a ranges of X(eg. the X axis is of length 100, then I want the errorbars to represent the standard deviation of Y...

## 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...

## Java 8 change in UTF-8 decoding

java,utf-8,java-8,regression
We recently migrated our application to JDK 8 from JDK 7. After the change, we ran into a problem with the following snippet of code. String output = new String(byteArray, "UTF-8"); The byte array may contain invalid UTF-8 byte sequences. The same byte array upon UTF-8 decoding, results in two...

## Nonlinear total least squares/Deming regression

r,regression
I've been using nls() to fit a custom model to my data, but I don't like how the model is fitting and I would like to use an approach that minimizes residuals in both x and y axes. I've done a lot of searching, and have found solutions for fitting...

## 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...

## Used Predict function on New Dataset with different Columns

r,regression,predict

## Determining regression coefficients for data - MATLAB

matlab,matrix,regression,numerical-methods
I am doing a project involving scientific computing. The following are three variables and their values I got after some experiments. There is also an equation with three unknowns, a, b and c: x=(a+0.98)/y+(b+0.7)/z+c How do I get values of a,b,c using the above? Is this possible in MATLAB?...

## Graphing different sets of data on same graph within a ‘for’ loop MATLAB

matlab,for-loop,plot,regression
I just have a problem with graphing different plots on the same graph within a ‘for’ loop. I hope someone can be point me in the right direction. I have a 2-D array, with discrete chunks of data in and amongst zeros. My data is the following: A= 0 0...

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

javascript,jquery,highcharts,regression

## How to rescale “linear predictor” in drawing nomogram with “rms” package in R?

r,regression
I am trying to draw a nomogram from a logistic regression in R by using the rms package, but currently I have a problem: indeed, I can get the nomogram, but the "linear predictor" axis ranges from -2.5 to +3, and I'd like to know whether I can make it...

## 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...

## Why do I get this error below while using the Cubist package in R?

r,regression,decision-tree,non-linear-regression
I have some personal dataset. So I split it into variable to predict and predictors. Following is the syntax: library(Cubist) str(A) 'data.frame': 6038 obs. of 3 variables: $ads_return_count : num 7 10 10 4 10 10 10 10 10 9 ...$ actual_cpc : num 0.0678 0.3888 0.2947 0.0179...

## Why does not GridSearchCV give best score ? - Scikit Learn

python,r,machine-learning,scikit-learn,regression
I have a dataset with 158 rows and 10 columns. I try to build multiple linear regression model and try to predict future value. I used GridSearchCV for tunning parameters. Here is my GridSearchCV and Regression function : def GridSearch(data): X_train, X_test, y_train, y_test = cross_validation.train_test_split(data, ground_truth_data, test_size=0.3, random_state =...

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

r,machine-learning,classification,regression,caret
How do I find whether model type for all models at once? I know how to access this info if I know the algo name, e.g.: library('Caret') tail(name(getModelInfo())) [1] "widekernelpls" "WM" "wsrf" "xgbLinear" "xgbTree" [6] "xyf" getModelInfo()$xyf$type [1] "Classification" "Regression" How do I see the \$type for all the algos...

## Input format for functions in package strucchange?

r,regression,trend
I'm trying to do change point detection with ´monitor´ from the strucchange package, but I have trouble getting a useful output. My input is a time stamped dataframe, and I would like the breaks to be returned as dates, but they are returned as observation number: cDF1 <- myDF[1:80,] >...