How Do You Optimize a and b in Linear Regression for Minimal Deviation?

In summary: X.In summary, for a given set of data points (x,y), where y=ax+b, the objective is to find the optimal values of a and b that minimize the sum of absolute deviations and the maximum deviation between the experimental and predicted values. To do this, we can use the Ordinary Least Square method, which involves calculating the values of b and a using the formulas provided.
  • #1
oleandora
2
0

Homework Statement



I've been given a set of data
x 0 0.5 0.7 1.5 1.75
y 0.5 0.72 0.51 1.5 1.63

Given y=ax+b

for this data points of linear model, I have to
1. minimize the sum of the absolute values of deviations between experimental value of Y and value predicted by the linear relation
2. minimiza the maximum value of deviation between all experimental values of Y and value predicted by linear relation

The question is
What are the optimal values of a and b for both cases and values of objective function.

Homework Equations


The Attempt at a Solution


What I know is
y=ax+b+e where e is the deviation but that's it. I don't even have the slightest idea for the next steps.
I know seems simplebut I have very little background on linear regression.
Help! T_T
 
Physics news on Phys.org
  • #2
Hey, this is the first time I tried to help someone on this forum, so don't shoot me if I am wronge. If we are at the same level I guess you are supposed to use OLS Ordinary Least Square.

b = [tex]\sum[/tex] (Xi-[tex]\bar{X}[/tex])(Yi-[tex]\bar{Y}[/tex])/
[tex]\sum[/tex] (Xi-[tex]\bar{X}[/tex])2

a = [tex]\bar{Y}[/tex] - b[tex]\bar{X}[/tex]

where you sum from 1 to n.
[tex]\bar{X}[/tex] means the average
 
  • #3
I would approach this problem by first understanding the objective of the task. The goal is to find the optimal values of a and b that minimize the sum of absolute values of deviations and the maximum value of deviation between the experimental values of Y and the predicted values by the linear relation. This is known as the least absolute deviations (LAD) method.

To solve this problem, I would use the LAD regression method, which involves minimizing the objective function:

min Σ|y - (ax + b)| for the first case
min max|y - (ax + b)| for the second case

To find the optimal values of a and b, I would use an optimization algorithm such as gradient descent or the simplex method. These algorithms would help me find the values of a and b that minimize the objective function.

Alternatively, I could also use a statistical software package such as R or Python's scikit-learn to perform linear regression and find the optimal values of a and b. These tools have built-in functions that can perform LAD regression and provide the optimal values of a and b as well as the objective function values.

In summary, the optimal values of a and b can be found by using an optimization algorithm or a statistical software package to minimize the objective function. This will provide the best fit line for the given data points and help in predicting future values.
 

Related to How Do You Optimize a and b in Linear Regression for Minimal Deviation?

What is linear regression?

Linear regression is a statistical method used to analyze the relationship between two variables, where one variable is considered the dependent variable and the other is considered the independent variable. It is used to predict the value of the dependent variable based on the values of the independent variable.

What is the purpose of linear regression?

The purpose of linear regression is to identify and quantify the relationship between two variables. It is often used for prediction and forecasting, as well as for understanding the strength and direction of the relationship between the two variables.

What are the assumptions of linear regression?

The main assumptions of linear regression include linearity (the relationship between the variables is linear), independence (the observations are independent of each other), homoscedasticity (the variance of the errors is constant), and normality (the errors follow a normal distribution).

How is linear regression different from correlation?

Linear regression and correlation are both used to measure the relationship between two variables. However, linear regression is used to predict the value of the dependent variable based on the independent variable, while correlation is used to measure the strength and direction of the relationship between the two variables.

What are the steps involved in a linear regression analysis?

The steps involved in a linear regression analysis include data collection, data cleaning and preparation, model selection, model fitting, model evaluation, and interpretation of results. It is important to carefully select and prepare the data, choose an appropriate model, and thoroughly evaluate the model's performance before drawing conclusions from the results.

Similar threads

  • Set Theory, Logic, Probability, Statistics
2
Replies
64
Views
3K
Replies
8
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
903
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top