# LINEST

The `LINEST` formula is used to calculate the statistics for a line by calculating the line's slope and y-intercept. It is commonly used to find the best-fit straight line for a given set of data points.

## Usage

Use the `LINEST` formula with the syntax shown below, it has 1 required parameter and 3 optional parameters:

Parameters:
1. known_data_y (required):
An array or range containing the dependent data points.
2. known_data_x (optional):
An array or range containing the independent data points. Default is the array {1,2,3,...}.
3. calculate_b (optional):
A boolean indicating whether to calculate the y-intercept. Default is TRUE.
4. verbose (optional):
A boolean indicating whether to return additional regression statistics. Default is FALSE.

## Examples

Here are a few example use cases that explain how to use the `LINEST` formula in Google Sheets.

### Finding the slope and y-intercept of a line

By using the `LINEST` formula, it is easy to find the slope and y-intercept of a line given a set of data points.

### Creating a linear regression model

The `LINEST` formula can be used to create a linear regression model by finding the best-fit straight line for a given set of data points.

### Predicting future values

Once a linear regression model has been created using the `LINEST` formula, it can be used to predict future values based on the known data points.

## Common Mistakes

`LINEST` not working? Here are some common mistakes people make when using the `LINEST` Google Sheets Formula:

### Incorrect range references for known_data_y

One common mistake is to reference the wrong range for the known_data_y argument. Make sure the range includes only the y-values of the data you want to analyze.

### Missing or incorrect range references for known_data_x

If you want to include x-values in your analysis, make sure you provide a valid range for the known_data_x argument. If you don't want to include x-values, leave this argument blank.

### Incorrect input for calculate_b

The calculate_b argument should be either TRUE or FALSE. If it's set to TRUE, the formula will calculate both the intercept and slope of the regression line. If it's set to FALSE, the formula will only calculate the slope.

### Incorrect input for verbose

The verbose argument should be either TRUE or FALSE. If it's set to TRUE, the formula will return additional statistics about the regression analysis. If it's set to FALSE, the formula will only return the slope and intercept (if calculate_b is TRUE).

### Not understanding the output

The LINEST formula returns an array of values that correspond to the slope, intercept, r-square value, standard error, and other statistical measures. Make sure you understand what each value means and how to interpret them for your analysis.

The following functions are similar to `LINEST` or are often used with it in a formula:

• `SLOPE`

The `SLOPE` formula calculates the slope of the linear regression line that best fits the input data. It is commonly used in statistics to analyze trends and predict future values based on past performance.

• `INTERCEPT`

The `INTERCEPT` function calculates the point where the line of best fit for a set of data intercepts the y-axis. This function is commonly used in regression analysis to find the constant b in the equation y=mx+b where m is the slope of the regression line.

• `TREND`

The `TREND` formula is used to calculate future values based on historical data. It fits a straight line (using the method of least squares) to the arrays specified in the `known_data_y` and `known_data_x` parameters and then uses that line to calculate new y-values for the array specified in the `new_data_x` parameter. If `b` is set to TRUE, then the calculation will include the y-intercept of the line. This formula is commonly used in forecasting and trend analysis.

• `FORECAST`

The `FORECAST` function in Google Sheets is a statistical function that predicts a future value along a linear trend. It returns the predicted value for a chosen x value based on the linear regression of a set of known x and y values. This function is commonly used in finance to predict future values.

• `CORREL`

The `CORREL` formula returns the correlation coefficient between two sets of data. This coefficient represents the strength of the linear relationship between the two sets of data, with values ranging from -1 (perfect negative correlation) to 1 (perfect positive correlation).

You can learn more about the `LINEST` Google Sheets function on Google Support.