linear-regression

Equations for 2 variable Linear Regression

We are using a programming language that does not have a linear regression function in it. We have already implemented a single variable linear equation: y = Ax + B and have simply calculated the A and B coefficents from the data using a solution similar to this Stack Overflow answer. I know this problem gets geometrically harder ...

Linear regression for time series with Gnuplot

I am a big fan of Gnuplot and I used it all along my studies for various projects. Lately I wanted to use Gnuplot to chart some time series like weight loss, exercising results, gas consumptions etc. Therefore I scale the x-axis like set xdata time set timefmt "%d.%m %Y" set format x "%d.%m" Now I want to use the fit-function to gi...

Can I force two components in a three-way linear regression to be positive?

Hello, I'm sorry if I'm not using the correct mathemathical terms, but I hope you'll understand what I'm trying to accomplish. My problem: I'm using linear regression (currently least squares method) on the values from two vectors x and y against the result z. This is to be done in matlab, and I'm using the \-operator to perform the reg...

How to compute the p-value in hypothesis testing (linear regression)

Currently I'm working on an awk script to do some statistical analysis on measurement data. I'm using linear regression to get parameter estimates, standard errors etc. and would also like to compute the p-value for a null-hypothesis test (t-test). This is my script so far, any idea how to compute the p-value? BEGIN { ybar = 0.0 ...

Method to find "cleanest" subset of data i.e. subset with lowest variability

Hi all... I am trying to find a trend in several datasets. The trends involve finding the best fit line, but if i imagine the procedure would not be too different for any other model (just possibly more time consuming). There are 3 conceivable scenarios: All good data where all the data fits a single trend with a low variability All ...

Java library to do time series analysis

I need to do some analysis of an arbitrary amount of time series in Java. Among others i need to be able to use Linear regression, various smoothing techniques, filtering, etc. I'm not very keen of writing all this from scratch so, do you know of any good Java libraries for these kind of analysis? Edit: R- Seems like an good choice....

character recognition in Java

I have a new project that invloves on-line character recognition (recognizing characters as they are written). My idea is that each character is defined by a number of strokes that fit a mathmatical model. For instance, 'A' could be defined by three linear strokes; 'O' could be defined as a single circular stroke. The reason for using li...

Linear Regression and group by in R

I wan to do a linear regression in R using the lm() function. My data is an annual time series with one field for year (22 years) and another for state (50 states). I want to fit a regression for each state so that at the end I have a vector of lm responses. I can imagine doing for loop for each state then doing the regression inside the...

Plotting Regression results from lme4 in R using Lattice (or something else)

I have fit a regression using lme4 thanks to a previous answer. Now that I have a regression fit for each state I'd like to use lattice to plot QQ plots for each state. I would also like to plot error plots for each state in a lattice format. How do I make a lattice plot using the results of a lme4 regression? Below is a simple sample ...

Multiple Linear Regression

I am trying to use GLSMultipleLinearRegression (from apache commons-math package) for multiple linear regression. It is expecting a covariance matrix as input -- I am not sure how to compute them. I have one array of dependent variables and 3 arrays of independent variables. Any idea how to compute the covariance matrix? Note: I have 2...

normal vector from least squares-derived plane

I have a set of points and I can derive a least squares solution in the form z = Ax + By + C. The coefficients I compute are correct but how would I get the vector normal to the plane in an equation of this form? Simply using A B and C coefficients from this equation don't seem correct as a normal vector using my test dataset. Thanks ...

How to use aryule() in Matlab to extend a number series?

I have a series of numbers. I calculated the "auto-regression" between them using Yule-Walker method. But now how do I extend the series? Whole working is as follows: a) the series I use: 143.85 141.95 141.45 142.30 140.60 140.00 138.40 137.10 138.90 139.85 138.75 139.85 141.30 139.45 140.15 140.80 142.50 143.00 142.35 143.00 142...

How to get 95% CI in a linear regression in SAS

How do I get SAS to report the 95% CI for the parameter estimate in a linear regression (PROC GLM)? ...

Is Linear Regression the same thing as Ordinary Least Squares Regression in SPSS ?

I want to do a linear regression but I want to use Ordinary Least Squares which I think it is a type of Linear regression.. The software I use is SPSS and it only has linear regression, partial least squares and 2-stages least squares. I have no idea which one is Ordinary Least Squares (OLS) ...

How to do a linear regression into a BIRT report ?

Hello, How to make a linear regression on the chart displayed into your BIRT report. I have x and y data... but I don't see any function on eclipse BIRT to generate the linear regression... Any idea ? Many thanks ...

How to fit a linear regression model with two principal components in R ?

Let's say I have a data matrix d pc = prcomp(d) # pc1 and pc2 are the principal components pc1 = pc$rotation[,1] pc2 = pc$rotation[,2] Then this should fit the linear regression model right? r = lm(y ~ pc1+pc2) But then I get this error : Errormodel.frame.default(formula = y ~ pc1+pc2, drop.unused.levels = TRUE) : unequ...

What is the BigO of linear regression?

How large a system is it reasonable to attempt to do a linear regression on? Specifically: I have a system with ~300K sample points and ~1200 linear terms. Is this computationally feasible? ...

Line of best fit scatter plot

Hi, I'm trying to do a scatter plot with a line of best fit in matlab, I can get a scatter plot using either scatter(x1,x2) or scatterplot(x1,x2) but the basic fitting option is shadowed out and lsline returns the error 'No allowed line types found. Nothing done' Any help would be great, Thanks, Jon. ...

Create lm object from data/coefficients

Does anyone know of a function that can create an lm object given a dataset and coefficients? I'm interested in this because I started playing with Bayesian model averaging (BMA) and I'd like to be able to create an lm object out of the results of bicreg. I'd like to have access to all of the nice generic lm functions like diagnostic p...

Mysql multivariable linear regression

I am trying to do a multivarible (9 variables) linear regression on data in my mysql 5.0 database (the result value field only has 2 possible values, 1 and 0). I've done some searching and found I can use: mysql> SELECT -> @n := COUNT(score) AS N, -> @meanX := AVG(age) AS "X mean", -> @sumX := SUM(age) AS "X sum", -> @s...