I'm trying to plot an nls model with se
. Using se=T
seems to not be an option. While the topic has been somewhat discussed here and here, in summary we need to turn off se drawing when plotting nls with ggplot2 for it to work.
So, my question would be how to plot these errors?
My code is as follows:
A <- c(2.14,0.90,6.40,2.50,10.60,1.14,8.30,3.10,6.00,1.60,7.00,1.17,5.60,2.14,0.90,
6.40,2.50,10.60,1.14,8.30,3.10,6.00,1.60,7.00,1.17,5.60,2.14,0.90, 6.40,2.50,
10.60,1.14,8.30,3.10,6.00,1.60,7.00,1.17,5.60,2.14,0.90,6.40,2.50,10.60,1.14,
8.30,3.10,6.00,1.60,7.00,1.17,5.60)
B <- c(195.53250,255.57243,137.67337,157.52710,83.03922,216.30603,61.87585,
193.58356,126.80942,213.12280,137.50060,285.78766,144.18174,204.82289, 266.42932,
137.83316,150.79204,85.08704,195.09191,68.09929,194.24539,119.96574, 201.18025,
137.50060,275.70720,144.20467,195.53250,266.42932,138.24046,157.52710,65.70746,
216.30603,99.74814,194.24539,126.80942,213.12280,137.50060,285.78766,110.04981,
204.82289,255.57243,130.25267,150.79204,83.24710,195.09191,68.09929,193.58356,
114.37214,213.12280,137.50060,275.70720,144.20467)
datii <- cbind(A,B)
datii <- as.data.frame(datii)
ggplot(datii, aes(x = A, y = B))+
geom_point()+
geom_smooth(color="black", formula=y~a*x^b, method="nls", se=F,
method.args = list(start=c(a=150,b=2)) )
This will produce a graph with the dots and the nls model, but I want to plot the errors.
Help is greatly appreciated!