Thank you @nirgrahamuk , I had actually googled it myself as well and tried to use it in my code, but it seems like the function does not exist:
baseline <- fitModel(Defl_V_Rt ~ A*Height_Sensor_nm_Rt + B, data = df_sub)
Error in fitModel(Defl_V_Rt ~ A * Height_Sensor_nm_Rt + B, data = df_sub) :
could not find function "fitModel"
(the mosaic package is installed on my RStudio).