Games & Quizzes
Don't forget to Sign In to save your points
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
Games & Quizzes
You may need to watch a part of the video to unlock quizzes
Don't forget to Sign In to save your points
PERFECT HITS | +NaN | |
HITS | +NaN | |
LONGEST STREAK | +NaN | |
TOTAL | + |
Hey guys, in this video I'm going to talk about the Gompertz curve, or the Gompertz
function.
I'm going to go over what the function is and what the parameters are in the model.
And then I'm going to talk about fitting a Gompertz growth curve model in R and how you
do that using non-linear regression.
Before we get into the demo, let me go ahead and write out what the formula for the Gompertz
curve is.
It's a function f(t) is equal to a times e to the -b time e to the -c t.
It's a double exponential function with three parameters: a, b, and c.
And these three parameters stand for...a is an asymptote.
It's a horizontal asymptote, or if you're thinking about this in terms of a growth curve
model, so this could be the growth of a population f(t) at a certain time, then you can think
of the asymptote as the carrying capacity of the system.
Then b is going to be the displacement on the X-axis.
And c is going to be the growth rate.
Similar to models like a logistic model, which is used for modeling human population growth,
this model is also used for modeling limited population growth.
It's also sigmoidal.
Similar to the logistic regression--actually, the logistic and the Gompertz curves both
belong to a family of generalized logistic functions called Richard's curves.
And the main difference between a Gompertz curve a regular logistic curve is that, for
a logistic curve, as the population increases, the growth rate linearly decreases.
But in a Gompertz curve, as the population increases, the growth rate exponentially decreases.
The growth rate changes exponentially here and in a logistic, it changes linearly.
And so this model is commonly used as a population growth model for tumor cells.
Let me switch over to a paper.
This is the paper I was talking about.
It's called, Dynamics of Tumor Growth, and I'll put it in the description box below.
It's freely available online.
And this was the first paper to use the Gompertz curve to model tumor growth, which is a very
commonly--it's like a very well-known growth model for tumor cells after this paper.
And basically, this paper, I skimmed through it.
It said that tumor cells were initially thought to grow exponentially.
And they were thought to grow exponentially with a limit or asymptote, depending on the
nutrients that were available to the cell, or that would be available to the cell.
But this paper said instead that the growth rate of tumor cells much more closely follows
a Gompertz curve.
I'm going to do an example with tumor cells in this video and I got the tumor cells--I'll
put a link to this in the description box below--but I got the data of tumor cell volumes
from this random website.
This is a dataset attached to a book.
I don't actually have the book.
I just randomly google'd for tumor cell volume data.
But I'll put a link in the description box below if you guys also want to download the
dataset that I'm working on.
And so now let me go to R and actually do the demo.
Okay so I have my R code here and I'll also try to link this or upload this and put it
in the description box as well.
The first thing is I'm just setting the working directory and finding the data.
The dataset--I'm not completely sure of the context of this because I don't have the textbook
that goes with the data and the datasets don't come
with a description.
I'm not exactly sure what tumor type of cell this is but as you can see, the dataset comes
with 590 observations and 4 variables.
The variables of interest for us are the days, so this is our time T. And then has recordings
of the volume of a tumor cell.
And I believe the volume is reported as what's called a spheroid, so that's how you calculate
the volume of a tumor, from what I've read.
And the original dataset gives it in volumes of natural log of tumor volume.
I just wanted the original tumor volume, so what I did was, I converted the log back to
it's original just by taking the exponent and I added that to the dataset.
I converted from the natural log to get back to the regular tumor volume.
And if you look at the dataset, there's a column for ID and this seems to ID different
types of tumor cells that were measured.
They analyze the growth of tumor cells over time for different tumor cells.
Another thing I wanted to do with the dataset was just get one of the tumor cells.
I wanted to curve just for one tumor cell.
This--the code that I just ran to plot the data--this plots all the different type of
tumor cells.
You can see, they appear to have basically different types of growth rates.
And so, I just want to model one growth rate.
And also there seems to be some outliers.
The next part of the code, I removed the outliers.
I said, I think anything over like 1,000 or something--or 1,200--to remove that data as
an outlier.
And also I said just to get one group of tumor cells.
After I removed the outliers and subset for just one tumor cell growth, then I'm going
to replot the data, and when I replot the data, it shows me now the growth of one tumor
cell.
It shows me the volume plotted over time.
Time is the X-axis in days and this is the spheroid growth in volume over time.
This is what we want to fit a Gompertz model to.
Basically, what I wanted to do is a regression.
I wanted to regress the growth or the size in volume on time.
And from the function that I showed you in the beginning of the video, you saw that the
function is a double exponent.
Not only is it not linear, it's not even exponential.
It's doubly exponential.
If I wanted to do this type of model, this is what's called a non-linear regression problem
because the parameters are not linearly--not a linear combination for the Y, or the f(t).
To do that in R, I'm going to load in this library called 'easynls'.
It basically fits nonlinear regression models.
Also in this video, I wanted to fit the model first as an exponential model, just because,
in the paper, it said that people used to think that tumor cell growth was exponential
up to a certain asymptote when the cell ran out of nutrients.
I wanted to first fit it using the exponential model just to show that it's not a good fit
for the data.
And when you're fitting a nonlinear regression model, it's different from linear regression
because when you're trying to estimate your parameter values, which the Gompertz model
has three parameters a, b, c, there's not closed-form solution for most nonlinear regression
problems.
You have to do basically numerical approximations.
With estimating the parameters, you have to input usually some sort starting values and
then, using an optimization algorithm, a computer will give you better estimates.
You have to do that for both an exponential model and for the Gompertz model.
For the exponential model, there are just two parameters, a and b.
This looks like it's maybe the starting value and then this is the growth rate.
B would be the growth rate.
I just fit the model and for this code, the nonlinear sfit will fit the model to my data.
Model = 6 means to fit it as an exponent, and then 'start' gives you the starting values.
So I did that and then this gives me an exponential model, so a times e to the b X.
And then this gives me my final estimates for the parameters.
For the parameter a, the final estimate was 120 and for the growth rate, the estimate
was .008.
And now, the next part, I'm going to fit that exponential model to the data and plot it
as a curve.
When I do that, you get this.
This is the actual data, the red dots.
And then this is what the exponential model would look like.
And here it says that the R-squared or the variance explained, in the model is .32 you
can say.
It's not very good.
You can see that literally almost none of the points fall anywhere near this line.
This doesn't seem to be capturing the growth rate of the tumor volumes very well.
Next, I tried fitting it with the Gompertz model.
In nlsfit, the Gompertz model is model number 10.
And the starting values, I did it based on what the plots of the observations look like.
To get starting values, a is the asymptote.
The asymptote is a horizontal kind of limit to the data.
You can see that it's about 250.
I think I said 200.
Yeah.
I said 200 as a starting value.
You want to just give it an estimate that's close for the program to be able to estimate
the values correctly.
Then b we said was the displacement on the X-axis.
There doesn't seem to be much displacement.
The earliest observation seems to be a little bit ahead of 0.
I estimated that as 2.
And then the growth rate is kind of like the slope.
If you think of this as rise over run, I said that the growth rate seems to be about 1 over
10.
With those starting values, I input that into this function and then this gives me the final
estimates after optimizing.
This is saying that the final asymptote was actually around 203, so very close.
This was saying that the displacement on the X-axis was 5 and not 2.
And then this was saying that the growth rate was about .159 and not .1.
And now finally, let me plot the actual model fit to the data and show you the fit statistics.
Now you can see that the Gompertz model, which is sigmoidal in shape, much better fits the
tumor cell growth.
You see that it's capturing the rapid growth in the beginning and also the asymptotic leveling
off towards the end.
And it gives me the equation with the final parameter estimates.
And now our variance explained in the R-squared is .88.
It's very close to 1 and you can tell just be how close the points are to the actual
model that the model is much better capturing the population growth for tumor cells.
All right, that's it for this video and thank you guys for watching.
*chiptune music*
How to use "asymptotic" in a sentence?
Metric | Count | EXP & Bonus |
---|---|---|
PERFECT HITS | 20 | 300 |
HITS | 20 | 300 |
STREAK | 20 | 300 |
TOTAL | 800 |
Sign in to unlock these awesome features: