In [ ]:
 

Download (right-click, save target as ...) this page as a jupyterlab notebook Lab29


Laboratory 30: Exponential, Logarithmic, Power-Law Models

LAST NAME, FIRST NAME

R00000000

ENGR 1330 Exercise 30 - Homework


Exercise 1

The following data are the temperature as a function of vertical depth in a chemically active settling pond.

Depth (cm) Temp ($^o$C)
0.1 21.2
0.8 27.3
3.6 31.8
12 35.6
120 42.3
390 45.9
710 47.7
1200 49.2
1800 50.5
2400 51.4

Fit the following data models.

  1. Linear data model
  2. Exponential data model
  3. Logarithmic data model
  4. Power-law model

Produce a plot of the data and data model for each model (4 plots)

Select the "best" model based on the $R^2$ value.

Use the best model to predict the temperature at 1 meter and 2 meters depth.

In [1]:
# Load the necessary packages
import numpy as np
import pandas as pd
import statistics 
import math
from matplotlib import pyplot as plt
import statsmodels.formula.api as smf
In [ ]:
# build the data lists
# build a dataframe
# Initialise and fit a linear regression model using `statsmodels`
# Predict values
# Plot regression against actual data
In [ ]:
# build the data lists
# build a dataframe
# Initialise and fit an exponential regression model using `statsmodels`
# Predict values
# Plot regression against actual data
In [ ]:
# build the data lists
# build a dataframe
# Initialise and fit a logarithmic regression model using `statsmodels`
# Predict values
# Plot regression against actual data
In [ ]:
# build the data lists
# build a dataframe
# Initialise and fit a power-law regression model using `statsmodels`
# Predict values
# Plot regression against actual data
In [ ]:
# Choose the "good" data model
# With your "good" model answer the questions
In [ ]: