Good Evening (or morning) everyone,
I have been trying to fit a non-linear regression line into my standard curve. However, I am getting the following error:
I have been using the following code:
stat_smooth(method= "nlm", formula = y ~ a*x^b, method.args = list(start = c(a = 470, b = 460)), se=FALSE)+
I am not sure whether the value 'a' and 'b' are correct, as I have taken them from the regline equation code:
stat_cor(label.y = c(825), label.x = c(0.88), aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")))+ stat_regline_equation(label.x=0.88, label.y=750)+
I have never been fitting a non-linear regression line. However, it is crucial in this experiment as I have got two variables only (concentration and the ratio) in a non-linear relationship.
This is the following code used
library(tidyverse) library(tidyr) library(dplyr) library(readr) library(ggplot2) library(ggpubr) library(gridExtra) library(cowplot) ggplot(data = STD, aes(x = Absorbance, y = STD)) + labs(title = "Quantifying PGD2 in cell culture lysates and its enzymatic reactions ", caption = "PGD2 ELISA")+ geom_point(colour = "#69b3a2")+ stat_smooth(method= "nlm", formula = y ~ a*x^b, method.args = list(start = c(a = 470, b = 460)), se=FALSE)+ xlab(expression(paste("%B/"~B)))+ ylab(expression(paste("Prostaglandin"~ D, ~~ " MOX Concentration (pg/ml) ")))+ theme(plot.background = element_rect(fill = "transparent"), panel.background = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+ theme(legend.spacing.y = unit(0.01, "cm"))+ theme(legend.position = c(0.77, .91), legend.background = element_rect(colour = NA, fill = NA))+ theme(plot.title = element_text(size = 12, face = "bold.italic"), plot.caption = element_text(hjust = 0))
That produced the following outcome
Before that, I have added a line, but it is not a non-linear regression line tho.
Moreover, I have been thinking about whether the non-linear equation fits my graph, but it fulfills the legibility of the equation, so this is not the case.
Thank you so much for your help.