### Chapter 10 Code Examples

### MATLAB Code Examples

1 2 |
sz=45;%sets the size of circles in the plot scatter (TSS_MAX,IBI,sz,'ko','filled');%x axis is TSS black circles |

### Python Code Examples

1 2 3 4 5 6 7 8 9 10 |
import math import matplotlib.pyplot as plt import numpy as np IBI=np.zeros(9) TSS_MAX=np.zeros(9) IBI=paintcr2csv[0:9,0] TSS_MAX=paintcr2csv[0:9,1] x=TSS_MAX y=IBI plt.scatter(TSS_MAX, IBI) |

### Exercises

- Use the Paint Creek dataset to find the coefficients for a linear model using at least two of the different procedures in either MATLAB or Python. For the procedures that do not produce a graph, create a graph showing the regression line and the distribution of the original points around that line. Create a report showing your results.
- Use the light dataset to create both the transformed linear model and a nonlinear, exponential model of the relationships in either MATLAB or Python. For the linear model, calculate the predicted values from the model and plot that as a line along with the scatter of points from the original dataset. For the nonlinear model, create a similar graph. Compare the two models in relation to the values of adjusted R2, the significance of the coefficients, and the scatter of the original data around the predicted curve. Which model do you think works better in this instance? Create a report showing your results and analysis.
- Find another dataset of interest to you where you hypothesize a cause and effect relationship between one response variable and one or more predictor variables. Plot the relationships and then choose one or more curve fitting functions to test the strength of the relationships. Prepare a report showing the statistical results and plots illustrating the model