Nonlinear regression - how to fit a dose-response curve in R

Published: 05 June 2023
on channel: TileStats
3,972
35

https://www.tilestats.com/

R code
X=c(1e-9 , 1e-8 , 1e-7 , 1e-6 , 1e-5 , 1e-4 , 1e-3 , 1e-2) #Dose
Y=c(0, 3, 8, 19, 31, 38, 40, 41) #Response
df=data.frame(X,Y)
plot(X,Y,log="x",xlab="Dose (M)",ylab="Response")
bottom=0 # Fix bottom to zero
f1=Y~ bottom+(top-bottom)/(1+10^((logEC50-log10(X))*h))
nls(f1,data=df, start=list(logEC50=-6,h=1,top=42))
Plot
m1=nls(f1,data=df, start=list(logEC50=-6,h=1,top=42)) # Save output
logEC50=coef(m1)[1]
h=coef(m1)[2]
top=coef(m1)[3]
X1=seq(-9,-2,0.1) # X-data for the curve
y=bottom+(top-bottom)/(1+10^((logEC50-X1)*h)) # Y data
lines(10^X1,y,col="blue",lwd=2) # plot the curve


Watch video Nonlinear regression - how to fit a dose-response curve in R online without registration, duration hours minute second in high quality. This video was added by user TileStats 05 June 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,972 once and liked it 35 people.