Home > OS >  fit a scatter plot with Weibull curve with ggplot2
fit a scatter plot with Weibull curve with ggplot2

Time:10-27

I'm not sure if this is duplicate question. But I really hope to get help from here.

I want to plot a graph like in the attachment below, fitting a 2-parameters Weibull curve. The x-axis is days and y-axis is biomaker level, with a cut off is 0.5.

enter image description here

2. dweibull

nls(y ~ 46 * dweibull(x, shape, scale), start = c(shape = 3, scale = 20))

Nonlinear regression model
  model: y ~ 46 * dweibull(x, shape, scale)
   data: parent.frame()
 shape  scale 
 2.375 23.378 
 residual sum-of-squares: 27.93

Number of iterations to convergence: 9 
Achieved convergence tolerance: 4.33e-06

plot(y ~ x)
curve(46 * dweibull(x, 2.375, 23.378), add = TRUE)

enter image description here

  • Related