Example data with weibull decay for growth:
library(tidyverse)
# example weibull
example_df <- data.frame(
day = 1:30,
growth = dweibull(seq(1, 30, by = 1), shape = 0.1)
)
example_df |> ggplot(aes(x = day, y = growth)) +
geom_point()
Data looks like this:
example_df |> head()
day growth
1 1 0.036787944
2 2 0.018348802
3 3 0.012186100
4 4 0.009104847
5 5 0.007257658
6 6 0.006027639
Each day, growth decreases a little - a decay.
I would like to predict decay on a given day. Here's where I get confused.
Suppose I'm asked what decay is on day 20? Or day 25? How can I use a weibull regression to tell me? Tried something:
library(fitdistrplus)
fit.weibull <- fitdist(example_df$growth, distr = "weibull", method = "mle", lower = c(0, 0))
fit.weibull |> summary()
Fitting of the distribution ' weibull ' by maximum likelihood
Parameters :
estimate Std. Error
shape 0.962954378 NA
scale 0.004707553 NA
Loglikelihood: 130.1494 AIC: -256.2989 BIC: -253.4965
Correlation matrix:
[1] NA
This seems to fit a weibull curve to my data. But I also need to 'tell it' that growth is dependent on day.
I looked at survreg and survival packages but they want binary 1/0 data for survived/not survived. For my problem, I just want to associate day with growth using a weibull to be able to predict growth on a given day index.
How can I use a weibull to predict growth on a given day?
fitdist
! That's not performing a regression: it's estimating a (univariate) distribution function. You need software to perform nonlinear regression; but what kind of nonlinear regression and which software will depend on the conditional distribution you assume for the model. $\endgroup$R
code. $\endgroup$