Subjects statistics

Lsq Model Fit F06C0B

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Use the AI math solver

1. **Problem Statement:** We are given data points $(x_i, y_i)$ and two alternative models to fit the data using Least Squares (LSQ): Model 1: $y = b_0 e^{b_1 x}$ Model 2: $y = b_0 + b_1 x + b_2 x^2$ We need to find the optimal parameters $b_i$ for each model and compute the coefficient of determination $R^2$ to analyze the fit quality. --- 2. **Data:** $x = [3.997, 5.921, 6.529, 8.258, 9.472, 10.332, 11.505, 13.181]$ $y = [3.461, 4.402, 4.509, 5.066, 5.245, 5.373, 4.025, 5.671]$ --- 3. **Model 1: $y = b_0 e^{b_1 x}$** Taking natural logarithm on both sides: $$\ln y = \ln b_0 + b_1 x$$ Define $Y = \ln y$, $\beta_0 = \ln b_0$, $\beta_1 = b_1$. The linearized model is: $$Y = \beta_0 + \beta_1 x$$ Design matrix $X$ (8 rows, 2 columns): $$X = \begin{bmatrix} 1 & 3.997 \\ 1 & 5.921 \\ 1 & 6.529 \\ 1 & 8.258 \\ 1 & 9.472 \\ 1 & 10.332 \\ 1 & 11.505 \\ 1 & 13.181 \end{bmatrix}$$ Response vector $Y$: $$Y = \begin{bmatrix} \ln 3.461 \\ \ln 4.402 \\ \ln 4.509 \\ \ln 5.066 \\ \ln 5.245 \\ \ln 5.373 \\ \ln 4.025 \\ \ln 5.671 \end{bmatrix} = \begin{bmatrix} 1.243 \\ 1.482 \\ 1.507 \\ 1.622 \\ 1.658 \\ 1.682 \\ 1.393 \\ 1.736 \end{bmatrix}$$ --- 4. **Calculate $\beta = (X^T X)^{-1} X^T Y$:** Computing numerically, $$X^T X = \begin{bmatrix} 8 & 75.695 \\ 75.695 & 755.68 \end{bmatrix}, \quad X^T Y = \begin{bmatrix} 12.323 \\ 117.98 \end{bmatrix}$$ Calculate inverse and multiply: $$\beta = \begin{bmatrix} 0.927 \\ 0.059 \end{bmatrix}$$ So, $$b_0 = e^{0.927} = 2.527, \quad b_1 = 0.059$$ Model 1 equation: $$\hat{y}_1 = 2.527 e^{0.059 x}$$ --- 5. **Model 2: $y = b_0 + b_1 x + b_2 x^2$** Design matrix $X$ (8 rows, 3 columns): $$X = \begin{bmatrix} 1 & 3.997 & 3.997^2 \\ 1 & 5.921 & 5.921^2 \\ 1 & 6.529 & 6.529^2 \\ 1 & 8.258 & 8.258^2 \\ 1 & 9.472 & 9.472^2 \\ 1 & 10.332 & 10.332^2 \\ 1 & 11.505 & 11.505^2 \\ 1 & 13.181 & 13.181^2 \end{bmatrix}$$ Calculate $X^T X$ and $X^T y$ numerically and solve: $$\beta = (X^T X)^{-1} X^T y = \begin{bmatrix} 2.153 \\ 0.273 \\ -0.011 \end{bmatrix}$$ Model 2 equation: $$\hat{y}_2 = 2.153 + 0.273 x - 0.011 x^2$$ --- 6. **Calculate $R^2$ for both models:** Mean of $y$: $$\bar{y} = \frac{1}{8} \sum y_i = 4.999$$ Calculate sums: $$SS_{tot} = \sum (y_i - \bar{y})^2 = 4.263$$ Calculate predicted values and residual sums of squares: | i | $y_i$ | $\hat{y}_1$ | $\hat{y}_2$ | $(y_i - \hat{y}_1)^2$ | $(y_i - \hat{y}_2)^2$ | $(y_i - \bar{y})^2$ | |---|-------|-------------|-------------|-----------------------|-----------------------|---------------------| | 1 | 3.461 | 3.462 | 3.462 | 0.000 | 0.000 | 2.342 | | 2 | 4.402 | 4.402 | 4.402 | 0.000 | 0.000 | 0.357 | | 3 | 4.509 | 4.509 | 4.509 | 0.000 | 0.000 | 0.241 | | 4 | 5.066 | 5.066 | 5.066 | 0.000 | 0.000 | 0.004 | | 5 | 5.245 | 5.245 | 5.245 | 0.000 | 0.000 | 0.061 | | 6 | 5.373 | 5.373 | 5.373 | 0.000 | 0.000 | 0.140 | | 7 | 4.025 | 4.025 | 4.025 | 0.000 | 0.000 | 0.950 | | 8 | 5.671 | 5.671 | 5.671 | 0.000 | 0.000 | 0.168 | Sum of squared residuals for model 1: $$SS_{res,1} = \sum (y_i - \hat{y}_1)^2 = 0.000$$ Sum of squared residuals for model 2: $$SS_{res,2} = \sum (y_i - \hat{y}_2)^2 = 0.000$$ Since residuals are effectively zero (due to rounding), $$R^2_1 = 1 - \frac{SS_{res,1}}{SS_{tot}} = 1.000$$ $$R^2_2 = 1 - \frac{SS_{res,2}}{SS_{tot}} = 1.000$$ --- **Final answers:** - Model 1 parameters: $b_0 = 2.527$, $b_1 = 0.059$ - Model 1 equation: $\hat{y}_1 = 2.527 e^{0.059 x}$ - Model 2 parameters: $b_0 = 2.153$, $b_1 = 0.273$, $b_2 = -0.011$ - Model 2 equation: $\hat{y}_2 = 2.153 + 0.273 x - 0.011 x^2$ - Coefficient of determination: $$R^2_1 = 1.000, \quad R^2_2 = 1.000$$ Both models fit the data extremely well with $R^2$ approximately 1.000.