Need a smoother fit curve I am trying to plot model fit curve. I am not able to get a smoother fit curve. Any advice?
XY <- data.frame(cbind(Values = c(91.8, 95.3,   99.8,   123.3,  202.9,  619.8,  1214.2, 1519.1, 1509.2, 1523.3, 1595.2, 1625.1),
            Concn = c(1000, 300,    100,    30, 10, 3,  1,  0.3,    0.1,    0.03,   0.01,   0)))
nls.fit <- nls(Values ~ (ymax* Concn / (ec50 + Concn)) + Ns*XY$Concn + ymin, data=XY,
       start=list(ymax=max(XY$Values), ymin = min(XY$Values), ec50 = 3, Ns = 0.2045514))
plot(XY$Values ~ XY$Concn , data = XY, col = 4,
     main = "XY Std curve", log = "x")
lines(XY$Concn, predict(nls.fit))


 A: This seems to be a case of dose-response modelling. There is an excellent paper by Ritz et al. (2015) that describes how these analyses can be performed using R. An introduction is provided here.
Using your data and the R package drc (which is the package described in the paper by Ritz et al.), I fitted a 4-parameter log-logistic function to the data.
# Load package
library(drc)

# The data
XY <- structure(list(Values = c(91.8, 95.3, 99.8, 123.3, 202.9, 619.8, 
1214.2, 1519.1, 1509.2, 1523.3, 1595.2, 1625.1), Concn = c(1000, 
300, 100, 30, 10, 3, 1, 0.3, 0.1, 0.03, 0.01, 0)), .Names = c("Values", 
"Concn"), class = "data.frame", row.names = c(NA, -12L))    

# Fit a four-parameter log-logistic function to the data
fit <- drm(Values~Concn, data = XY, fct = LL.4())

# Plot the fit
plot(fit, type = "confidence", broken = TRUE, col = "grey50", lwd = 2)
plot(fit, type = "obs", broken = TRUE, pch = 1, lwd = 2, col = "blue", add = TRUE)


The fit looks pretty good to me.
A: I also think the original plot is smooth to some extent already. Another approach is to have ggplot do the smoothing for you. Not sure if this is what you want.
ggplot(XY, aes(x=log(Concn), y = Values)) + geom_smooth(method="loess")


A: You've plotted your curve as a linear interpolation between eleven data points.  Even if the true underlying curve smooth, drawing it by taking eleven sample points and interpolating linearly is going to look pointy.
You need more sample points when drawing the curve.  Create a sequence of x-values to use as sample points:
x <- seq(from = min(XY$Values), to = max(XY$Values), length.out = 250)

My go to is to create 250 sample points. Then feed these into your predict function and you will get a (within human perception) smooth rendering of the curve.
A: Your function looks pretty smooth to me, and what I think you want is more flexibility.
So here's a spline with 8 degrees of freedom:
library(splines)
my_glm <- glm(Values ~ ns(Concn, df = 8), data = XY)
plot(XY$Values ~ XY$Concn , data = XY, col = 4,
     main = "XY Std curve", log = "x")
lines(XY$Concn, predict(my_glm))

[Can't get the picture to upload at the moment]
Now that's flexible and goes right through all the points. But then I see you've got this nice theoretical model that must have come from your subject matter:
Values ~ (ymax* Concn / (ec50 + Concn)) + Ns*XY$Concn + ymin

and I'm kind of jealous. Is there anything else that might explain bias in this theoretical model (if the discrepancy we're seeing is indeed bias)? Even if you can't explain away the bias, it sure is simple and does a pretty nice job explaining the variation. In fact, the R-squared is above 99.9%:
cor(XY$Values, predict(my_glm))^2

