Wow, I am impressed. Thank you so much. I have checked your suggestions using simple plot and everything was working, however when I tried with ggplot it was giving an error that says Error in FUN(X[[i]], ...) : object 'predicted' not found, that strange because I used the following codes:
#to create data.frame
line <- data.frame(
x = seq(min(std$Absorbance * 0.9), max(std$Absorbance) * 1.1, length.out = 100)
)
then,
#for predictions
> line$y <- stats::predict(model, line)
then,
ggplot(std, aes(Absorbance, STD)) +
labs(title = "Quantifying PGD2 in cell culture lysates and its enzymatic reactions ",
caption = "PGD2 ELISA")+
geom_point(colour = "#69b3a2")+
geom_line(data = line, aes(x = x, y = y), colour = "gray30") +
geom_point(data = unknowns, aes(abs, predicted), colour = "tomato") +
scale_x_log10() + *#it cannot find predicted object, despite it was called*
scale_y_continuous(breaks = seq(0,1000, by=100))+
xlab(expression(paste("%B/"~B[0])))+
ylab(expression(paste("Prostaglandin"~ D[2], ~~ " MOX Concentration (pg/ml) ")))+
theme(plot.background = element_rect(fill = "transparent"),
panel.background = element_blank(),
panel.grid.major = element_line(color = "grey",
size = 0.1,
linetype = 2),
panel.grid.minor = element_line(color = "grey",
size = 0.1,
linetype = 2),
axis.line = element_line(colour = "black"))+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
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))
BTW i quite like col = "tomato". Thank you so much.
EDIT
Maybe you will know, when I am using basic plot it indeed produces great graph:
and the warning:
Error in e2[[j]] : subscript out of bounds
#code to produce this outstanding graph
unknowns <- data.frame(
abs = c(0.347666713, 0.336450405, 0.359086619, 0.353371707, 0.362272805, 0.33008683, 0.340278523, 0.35457017, 0.38138226, 0.320159559, 0.324005727, 0.344093381, 0.288453324, 0.365552809, 0.359411168, 0.391631708)
)
std <- data.frame(
STD = c(0, 5, 20, 80, 250, 1000),
Absorbance = c(1.268967137, 0.736537869, 0.297820701, 0.283878975, 0.228719425, 0.131721101)
)
model <- drc::drm(STD ~ Absorbance, fct = drc::LL.4(), data = std)
unknowns$predicted <- stats::predict(model, unknowns)
plot(model, cex=1.5,
col= "blue",
pch=16,
sub = "PGD2 Elisa",
xlab = expression(paste("%B/"~B[0]),size = 1, adj= 0),
ylab = expression(paste("Prostaglandin" ~~~ D[2], ~~"MOX Concentration (pg/ml) "))
)+
grid(45,45)+
points(unknowns, cex=1.0, pch=16, col = "tomato") +
axis(side = 1, at=seq(0.2, 1.25, by = 0.1), labels = TRUE)+
grid(43, 43)+
title("Quantifying PGD2 in cell culture lysates and its enzymatic reactions ", adj = 0)+
legend("topright", legend = c("PGD2 MOX - Standard Curve"),
lwd = 1.5, pch=16, col = c("blue")
)
Any ideas why?
Again, thank you so much. You are a pure genius.