Home > Enterprise >  R plot stat_function() by group, with parameters in df
R plot stat_function() by group, with parameters in df

Time:01-31

I did some non-linear regression and retrieved the fitting coefficients/parameters b0,b1,b2, and b3 in a data frame df. I would like to plot the same function with parameters from each row as an overlay with the initial data points (from df2) that I have used for fitting. All contained in one single graph. Any help is appreciated. Thank you in advance!

group b0 b1 b2 b3
abc 6.3 8.9 1.66 0.025
def 5.1 8.9 1.48 1.27
ghi 5.5 9.0 1.41 1.03
group<-c("abc","def","ghi")
b0 <- c(6.3,5.1,5.5)
b1 <- c(8.9,8.9,9.0)
b2 <- c(1.66,1.48,1.41)
b3 <- c(0.025,1.27,1.03)
df <- data.frame(group,b0, b1, b2,b3)

I have tried to apply the solution from other posts but couldn't make it work.

The following just connects the points of all 3 functions without distinguishing between the group, as it does for geom_point() enter image description here

  •  Tags:  
  • Related