Exponential models using nls() in R

151 Views Asked by At

I have a dataset which resembles the following:

time <- c(0, 10, 20, 30, 40, 50, 60, 70 , 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190)
temp <- c(30, 28, 24, 20, 17, 13, 10, 9, 8, 7.5, 7, 6.5, 6, 5.8, 5.5, 5.3, 5.1, 5, 5, 5)

Ts = 5 # ambient temperature of surroundings
T0 = 30 # start temperature

plot(temp, time)

enter image description here

Using Newton's law of cooling, where Temp(time) ~ Ts + (T0)exp^-c*time I am trying to fit an exponential model in R to work out the value of c (i.e., the cooling rate).

From other questions on here, I feel that using nls() would be appropriate, but I am unsure how to set up the model given that I don't know the value of c. Any advice would be appreciated.

0

There are 0 best solutions below