How to plot a model drc package?

577 Views Asked by At

Script:

lettuce

m0<-drm(weight~conc, data = lettuce, fct = LL.3())

summary(m0)

modelFit(m0)

plot(m0)

I want to know how to plot the exact value of conc in the axis x with their corresponding value in y and how to plot the ().

1

There are 1 best solutions below

0
On BEST ANSWER

I'm taking my best shot at this question, but it is under the assumption that the question may be the result of difficulties with a user interface that was unstated and terminology that has not been clarified despite my efforts in comments. I'm assuming this was a request to annotate a drc plot with an R^2 value. The plot.drc function is a base graphics function, so will plot to the interactive device by default and appears to do so on my machine (a Mac), which will not always bring the quartz()-device window to the fore of the viewing layers. It needed to be pulled to the fore by using the dropdown menu.

I'm (now) going to demonstrate in code how to a) calculate an R^2 and b) annotate a base graphics graphic on a png()-device.

png()      # opens file for graphics output
plot(m0)   # will need dev.off() to complete output
cor( fitted(m0), lettuce$weight) ^2  # calculation of R^2
# [1] 0.8143727 # output to interactive console
text( x=20, y=1.2, labels= bquote(R^2 == .(cor( fitted(m0), lettuce$weight) ^2) ) )
dev.off()

enter image description here