0

I currently have the following plot and now wish to fit a second line to it but this time i want an exponential line. Appreciate it might me hard without knowing too much about my data. Imagine you might need some example of data/predictions so just ask if you need something extra here. Assume I'm looking at another geom_line() argument or stat_smooth() but unsure what to use inside them to keep an exponential curve.

code

    eastern_mod = gam(eastern_chloro ~ s(eastern_sst, k = 5, bs = "cs"), 
                  data = climate_df, 
                  family = gaussian(link = "identity"))
#predictions
eastern_preds = predict(eastern_mod, type = 'response', se.fit = 
TRUE)
#plot
eastern_plot = ggplot(climate_df, aes(y = eastern_chloro, x = 
eastern_sst)) + geom_point() + geom_line(aes(eastern_sst, eastern_preds$fit), colour = 'orange', 
size = 2)

data snipet

climate_df[, c("date", "eastern_sst", "eastern_chloro")]
          date eastern_sst eastern_chloro
1998-01-15      17.155          0.132
1998-02-15      16.504          0.132
1998-03-15      16.208          0.126
1998-04-15      17.702          0.087
1998-05-15      19.660          0.066
1998-06-15      23.512          0.051
1998-07-15      25.912          0.049
1998-08-15      27.226          0.056
1998-09-15      26.151          0.060
1998-10-15      24.440          0.063
1998-11-15      21.867          0.087
1998-12-15      18.797          0.155
1999-01-15      17.206          0.155
1999-02-15      16.345          0.146
1999-03-15      16.689          0.100

current plot

enter image description here

Joe
  • 795
  • 1
  • 11

0 Answers0