Plot asymptote in grotwth curve in R





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















How can I plot the line asymptote off this curve above?



 # Create Data
Conc <- c(0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000)

Response <- c(167.11246201, 53.96960486, 128.42857143, 43.67173252, 4.51975684, 0.34042553, 120.10334347, 101.14589666, 155.17629179, 35.31306991, 8.56534954, 1.71124620, 146.34954407, 108.50151976, 163.60182371, 64.70212766, 2.88145897, 0.50759878, 82.92401216, 109.80547112, 116.69300912, 26.85410334, 3.01519757, 0.37386018, 87.06990881, 84.82978723, 118.36474164, 27.52279635, 2.34650456, 0.10638298, 89.47720365, 109.47112462, 85.43161094, 17.69300912, 2.31306991, 0.07294833)

df <- data.frame(Conc = Conc, Response = Response)

#Make Modell
library(drc)
#adjust model
drm <- drm(Response ~ Conc, data = df, fct = LL.4())
#plot
plot(drm)


This is an exemple of what I mean?
enter image description here










share|improve this question























  • try abline with a= asymptote and b=0

    – Jrakru56
    Nov 16 '18 at 14:48











  • Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

    – Vitor Muller Anunciato
    Nov 16 '18 at 14:57













  • Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

    – Jrakru56
    Nov 16 '18 at 15:00


















-1















How can I plot the line asymptote off this curve above?



 # Create Data
Conc <- c(0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000)

Response <- c(167.11246201, 53.96960486, 128.42857143, 43.67173252, 4.51975684, 0.34042553, 120.10334347, 101.14589666, 155.17629179, 35.31306991, 8.56534954, 1.71124620, 146.34954407, 108.50151976, 163.60182371, 64.70212766, 2.88145897, 0.50759878, 82.92401216, 109.80547112, 116.69300912, 26.85410334, 3.01519757, 0.37386018, 87.06990881, 84.82978723, 118.36474164, 27.52279635, 2.34650456, 0.10638298, 89.47720365, 109.47112462, 85.43161094, 17.69300912, 2.31306991, 0.07294833)

df <- data.frame(Conc = Conc, Response = Response)

#Make Modell
library(drc)
#adjust model
drm <- drm(Response ~ Conc, data = df, fct = LL.4())
#plot
plot(drm)


This is an exemple of what I mean?
enter image description here










share|improve this question























  • try abline with a= asymptote and b=0

    – Jrakru56
    Nov 16 '18 at 14:48











  • Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

    – Vitor Muller Anunciato
    Nov 16 '18 at 14:57













  • Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

    – Jrakru56
    Nov 16 '18 at 15:00














-1












-1








-1








How can I plot the line asymptote off this curve above?



 # Create Data
Conc <- c(0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000)

Response <- c(167.11246201, 53.96960486, 128.42857143, 43.67173252, 4.51975684, 0.34042553, 120.10334347, 101.14589666, 155.17629179, 35.31306991, 8.56534954, 1.71124620, 146.34954407, 108.50151976, 163.60182371, 64.70212766, 2.88145897, 0.50759878, 82.92401216, 109.80547112, 116.69300912, 26.85410334, 3.01519757, 0.37386018, 87.06990881, 84.82978723, 118.36474164, 27.52279635, 2.34650456, 0.10638298, 89.47720365, 109.47112462, 85.43161094, 17.69300912, 2.31306991, 0.07294833)

df <- data.frame(Conc = Conc, Response = Response)

#Make Modell
library(drc)
#adjust model
drm <- drm(Response ~ Conc, data = df, fct = LL.4())
#plot
plot(drm)


This is an exemple of what I mean?
enter image description here










share|improve this question














How can I plot the line asymptote off this curve above?



 # Create Data
Conc <- c(0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000, 0.03125, 0.06250, 0.12500, 0.25000, 0.50000, 1.00000)

Response <- c(167.11246201, 53.96960486, 128.42857143, 43.67173252, 4.51975684, 0.34042553, 120.10334347, 101.14589666, 155.17629179, 35.31306991, 8.56534954, 1.71124620, 146.34954407, 108.50151976, 163.60182371, 64.70212766, 2.88145897, 0.50759878, 82.92401216, 109.80547112, 116.69300912, 26.85410334, 3.01519757, 0.37386018, 87.06990881, 84.82978723, 118.36474164, 27.52279635, 2.34650456, 0.10638298, 89.47720365, 109.47112462, 85.43161094, 17.69300912, 2.31306991, 0.07294833)

df <- data.frame(Conc = Conc, Response = Response)

#Make Modell
library(drc)
#adjust model
drm <- drm(Response ~ Conc, data = df, fct = LL.4())
#plot
plot(drm)


This is an exemple of what I mean?
enter image description here







r math statistics






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 14:34









Vitor Muller AnunciatoVitor Muller Anunciato

54




54













  • try abline with a= asymptote and b=0

    – Jrakru56
    Nov 16 '18 at 14:48











  • Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

    – Vitor Muller Anunciato
    Nov 16 '18 at 14:57













  • Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

    – Jrakru56
    Nov 16 '18 at 15:00



















  • try abline with a= asymptote and b=0

    – Jrakru56
    Nov 16 '18 at 14:48











  • Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

    – Vitor Muller Anunciato
    Nov 16 '18 at 14:57













  • Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

    – Jrakru56
    Nov 16 '18 at 15:00

















try abline with a= asymptote and b=0

– Jrakru56
Nov 16 '18 at 14:48





try abline with a= asymptote and b=0

– Jrakru56
Nov 16 '18 at 14:48













Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

– Vitor Muller Anunciato
Nov 16 '18 at 14:57







Unfortunately it did not work, that is the mensagem: Error in abline(a = asymptote, b = 0) : object 'asymptote' not found

– Vitor Muller Anunciato
Nov 16 '18 at 14:57















Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

– Jrakru56
Nov 16 '18 at 15:00





Sorry, I was not clear. I meant assign the value of the asymptote to the parameter a. See below

– Jrakru56
Nov 16 '18 at 15:00












3 Answers
3






active

oldest

votes


















0














I am not sure what is the right way here, but I usually do it like this:



Logistic funtion



Still don't know how to use LL.4() for this purpose



flogis <- function(x, b, c, d, e){
c + (d - c)/(1 + exp(b*(log(x) - log(e))))
}


Dataset



Make some example data:



dose <- rep(exp(seq(-5, 5, length.out = 10)), each = 3)
dat <- data.frame(
dose = dose,
response = flogis(dose, -1, 0, 1, .5) + rnorm(length(dose), 0, .05)
)

head(dat)
# dose response
#1 0.006737947 0.01310683
#2 0.006737947 0.08292573
#3 0.006737947 0.03263079
#4 0.020468076 0.02763111
#5 0.020468076 0.01934260
#6 0.020468076 0.01296994


Fitting 4-parameters log-logistic model



library(drc)

model <- drm(response ~ dose, data = dat, fct = LL.4())

summary(model)
#Model fitted: Log-logistic (ED50 as parameter) (4 parms)
#
#Parameter estimates:
#
# Estimate Std. Error t-value p-value
#b:(Intercept) -1.0012680 0.0887792 -11.2782 1.637e-11 ***
#c:(Intercept) 0.0049506 0.0243151 0.2036 0.8402
#d:(Intercept) 0.9889417 0.0163848 60.3573 < 2.2e-16 ***
#e:(Intercept) 0.4054848 0.0419639 9.6627 4.310e-10 ***
#---
#Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#Residual standard error:
#
#0.04466107 (26 degrees of freedom)


Grab model parameters for use with ggplot



coefs <- setNames(coef(model), c("b", "c", "d", "e"))
y50 <- predict(model, newdata = data.frame(dose = coefs["e"]))


Plot data



(Sorry, have no time to play with text labels, and don't understand what phi2 + phi3 means on the example plot, but pretty sure that is something which is going on around EC50)



ggplot(dat, aes(x = dose, y = response)) +
stat_function(fun = function(x, b, c, d, e){
c + (d - c)/(1 + exp(b*(log(x) - log(e))))
}, args = coefs, col = "skyblue", lwd = 1) +
geom_point(pch = 21, fill = "white") +
geom_hline(yintercept = coefs[c("c", "d")], lty = 2, colour = "gray50") +
geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
lty = 2, colour = "gray50") +
geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
lty = 2, colour = "gray50") +
scale_x_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", scales::math_format(10^.x))
) +
annotation_logticks(sides = "b") +
labs(x = "Dose",
y = "Response"
) +
expand_limits(y = 1) +
ggthemes::theme_few()


drm






share|improve this answer































    0














    try this :



    library(drc)

    #adjust model
    drm <- drm(Response ~ Conc, data = df, fct = LL.4())

    #plot
    plot(drm)
    abline(a=112.6868 , 0)


    enter image description here






    share|improve this answer































      0














      You can extract the value of the asymptote from the drm object:



      asymptote <- coef(drm)[3]


      This value can be used for plotting:



      plot(drm)
      abline(asymptote, 0)


      enter image description here






      share|improve this answer
























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339882%2fplot-asymptote-in-grotwth-curve-in-r%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0














        I am not sure what is the right way here, but I usually do it like this:



        Logistic funtion



        Still don't know how to use LL.4() for this purpose



        flogis <- function(x, b, c, d, e){
        c + (d - c)/(1 + exp(b*(log(x) - log(e))))
        }


        Dataset



        Make some example data:



        dose <- rep(exp(seq(-5, 5, length.out = 10)), each = 3)
        dat <- data.frame(
        dose = dose,
        response = flogis(dose, -1, 0, 1, .5) + rnorm(length(dose), 0, .05)
        )

        head(dat)
        # dose response
        #1 0.006737947 0.01310683
        #2 0.006737947 0.08292573
        #3 0.006737947 0.03263079
        #4 0.020468076 0.02763111
        #5 0.020468076 0.01934260
        #6 0.020468076 0.01296994


        Fitting 4-parameters log-logistic model



        library(drc)

        model <- drm(response ~ dose, data = dat, fct = LL.4())

        summary(model)
        #Model fitted: Log-logistic (ED50 as parameter) (4 parms)
        #
        #Parameter estimates:
        #
        # Estimate Std. Error t-value p-value
        #b:(Intercept) -1.0012680 0.0887792 -11.2782 1.637e-11 ***
        #c:(Intercept) 0.0049506 0.0243151 0.2036 0.8402
        #d:(Intercept) 0.9889417 0.0163848 60.3573 < 2.2e-16 ***
        #e:(Intercept) 0.4054848 0.0419639 9.6627 4.310e-10 ***
        #---
        #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
        #
        #Residual standard error:
        #
        #0.04466107 (26 degrees of freedom)


        Grab model parameters for use with ggplot



        coefs <- setNames(coef(model), c("b", "c", "d", "e"))
        y50 <- predict(model, newdata = data.frame(dose = coefs["e"]))


        Plot data



        (Sorry, have no time to play with text labels, and don't understand what phi2 + phi3 means on the example plot, but pretty sure that is something which is going on around EC50)



        ggplot(dat, aes(x = dose, y = response)) +
        stat_function(fun = function(x, b, c, d, e){
        c + (d - c)/(1 + exp(b*(log(x) - log(e))))
        }, args = coefs, col = "skyblue", lwd = 1) +
        geom_point(pch = 21, fill = "white") +
        geom_hline(yintercept = coefs[c("c", "d")], lty = 2, colour = "gray50") +
        geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
        lty = 2, colour = "gray50") +
        geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
        lty = 2, colour = "gray50") +
        scale_x_log10(
        breaks = scales::trans_breaks("log10", function(x) 10^x),
        labels = scales::trans_format("log10", scales::math_format(10^.x))
        ) +
        annotation_logticks(sides = "b") +
        labs(x = "Dose",
        y = "Response"
        ) +
        expand_limits(y = 1) +
        ggthemes::theme_few()


        drm






        share|improve this answer




























          0














          I am not sure what is the right way here, but I usually do it like this:



          Logistic funtion



          Still don't know how to use LL.4() for this purpose



          flogis <- function(x, b, c, d, e){
          c + (d - c)/(1 + exp(b*(log(x) - log(e))))
          }


          Dataset



          Make some example data:



          dose <- rep(exp(seq(-5, 5, length.out = 10)), each = 3)
          dat <- data.frame(
          dose = dose,
          response = flogis(dose, -1, 0, 1, .5) + rnorm(length(dose), 0, .05)
          )

          head(dat)
          # dose response
          #1 0.006737947 0.01310683
          #2 0.006737947 0.08292573
          #3 0.006737947 0.03263079
          #4 0.020468076 0.02763111
          #5 0.020468076 0.01934260
          #6 0.020468076 0.01296994


          Fitting 4-parameters log-logistic model



          library(drc)

          model <- drm(response ~ dose, data = dat, fct = LL.4())

          summary(model)
          #Model fitted: Log-logistic (ED50 as parameter) (4 parms)
          #
          #Parameter estimates:
          #
          # Estimate Std. Error t-value p-value
          #b:(Intercept) -1.0012680 0.0887792 -11.2782 1.637e-11 ***
          #c:(Intercept) 0.0049506 0.0243151 0.2036 0.8402
          #d:(Intercept) 0.9889417 0.0163848 60.3573 < 2.2e-16 ***
          #e:(Intercept) 0.4054848 0.0419639 9.6627 4.310e-10 ***
          #---
          #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
          #
          #Residual standard error:
          #
          #0.04466107 (26 degrees of freedom)


          Grab model parameters for use with ggplot



          coefs <- setNames(coef(model), c("b", "c", "d", "e"))
          y50 <- predict(model, newdata = data.frame(dose = coefs["e"]))


          Plot data



          (Sorry, have no time to play with text labels, and don't understand what phi2 + phi3 means on the example plot, but pretty sure that is something which is going on around EC50)



          ggplot(dat, aes(x = dose, y = response)) +
          stat_function(fun = function(x, b, c, d, e){
          c + (d - c)/(1 + exp(b*(log(x) - log(e))))
          }, args = coefs, col = "skyblue", lwd = 1) +
          geom_point(pch = 21, fill = "white") +
          geom_hline(yintercept = coefs[c("c", "d")], lty = 2, colour = "gray50") +
          geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
          lty = 2, colour = "gray50") +
          geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
          lty = 2, colour = "gray50") +
          scale_x_log10(
          breaks = scales::trans_breaks("log10", function(x) 10^x),
          labels = scales::trans_format("log10", scales::math_format(10^.x))
          ) +
          annotation_logticks(sides = "b") +
          labs(x = "Dose",
          y = "Response"
          ) +
          expand_limits(y = 1) +
          ggthemes::theme_few()


          drm






          share|improve this answer


























            0












            0








            0







            I am not sure what is the right way here, but I usually do it like this:



            Logistic funtion



            Still don't know how to use LL.4() for this purpose



            flogis <- function(x, b, c, d, e){
            c + (d - c)/(1 + exp(b*(log(x) - log(e))))
            }


            Dataset



            Make some example data:



            dose <- rep(exp(seq(-5, 5, length.out = 10)), each = 3)
            dat <- data.frame(
            dose = dose,
            response = flogis(dose, -1, 0, 1, .5) + rnorm(length(dose), 0, .05)
            )

            head(dat)
            # dose response
            #1 0.006737947 0.01310683
            #2 0.006737947 0.08292573
            #3 0.006737947 0.03263079
            #4 0.020468076 0.02763111
            #5 0.020468076 0.01934260
            #6 0.020468076 0.01296994


            Fitting 4-parameters log-logistic model



            library(drc)

            model <- drm(response ~ dose, data = dat, fct = LL.4())

            summary(model)
            #Model fitted: Log-logistic (ED50 as parameter) (4 parms)
            #
            #Parameter estimates:
            #
            # Estimate Std. Error t-value p-value
            #b:(Intercept) -1.0012680 0.0887792 -11.2782 1.637e-11 ***
            #c:(Intercept) 0.0049506 0.0243151 0.2036 0.8402
            #d:(Intercept) 0.9889417 0.0163848 60.3573 < 2.2e-16 ***
            #e:(Intercept) 0.4054848 0.0419639 9.6627 4.310e-10 ***
            #---
            #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
            #
            #Residual standard error:
            #
            #0.04466107 (26 degrees of freedom)


            Grab model parameters for use with ggplot



            coefs <- setNames(coef(model), c("b", "c", "d", "e"))
            y50 <- predict(model, newdata = data.frame(dose = coefs["e"]))


            Plot data



            (Sorry, have no time to play with text labels, and don't understand what phi2 + phi3 means on the example plot, but pretty sure that is something which is going on around EC50)



            ggplot(dat, aes(x = dose, y = response)) +
            stat_function(fun = function(x, b, c, d, e){
            c + (d - c)/(1 + exp(b*(log(x) - log(e))))
            }, args = coefs, col = "skyblue", lwd = 1) +
            geom_point(pch = 21, fill = "white") +
            geom_hline(yintercept = coefs[c("c", "d")], lty = 2, colour = "gray50") +
            geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
            lty = 2, colour = "gray50") +
            geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
            lty = 2, colour = "gray50") +
            scale_x_log10(
            breaks = scales::trans_breaks("log10", function(x) 10^x),
            labels = scales::trans_format("log10", scales::math_format(10^.x))
            ) +
            annotation_logticks(sides = "b") +
            labs(x = "Dose",
            y = "Response"
            ) +
            expand_limits(y = 1) +
            ggthemes::theme_few()


            drm






            share|improve this answer













            I am not sure what is the right way here, but I usually do it like this:



            Logistic funtion



            Still don't know how to use LL.4() for this purpose



            flogis <- function(x, b, c, d, e){
            c + (d - c)/(1 + exp(b*(log(x) - log(e))))
            }


            Dataset



            Make some example data:



            dose <- rep(exp(seq(-5, 5, length.out = 10)), each = 3)
            dat <- data.frame(
            dose = dose,
            response = flogis(dose, -1, 0, 1, .5) + rnorm(length(dose), 0, .05)
            )

            head(dat)
            # dose response
            #1 0.006737947 0.01310683
            #2 0.006737947 0.08292573
            #3 0.006737947 0.03263079
            #4 0.020468076 0.02763111
            #5 0.020468076 0.01934260
            #6 0.020468076 0.01296994


            Fitting 4-parameters log-logistic model



            library(drc)

            model <- drm(response ~ dose, data = dat, fct = LL.4())

            summary(model)
            #Model fitted: Log-logistic (ED50 as parameter) (4 parms)
            #
            #Parameter estimates:
            #
            # Estimate Std. Error t-value p-value
            #b:(Intercept) -1.0012680 0.0887792 -11.2782 1.637e-11 ***
            #c:(Intercept) 0.0049506 0.0243151 0.2036 0.8402
            #d:(Intercept) 0.9889417 0.0163848 60.3573 < 2.2e-16 ***
            #e:(Intercept) 0.4054848 0.0419639 9.6627 4.310e-10 ***
            #---
            #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
            #
            #Residual standard error:
            #
            #0.04466107 (26 degrees of freedom)


            Grab model parameters for use with ggplot



            coefs <- setNames(coef(model), c("b", "c", "d", "e"))
            y50 <- predict(model, newdata = data.frame(dose = coefs["e"]))


            Plot data



            (Sorry, have no time to play with text labels, and don't understand what phi2 + phi3 means on the example plot, but pretty sure that is something which is going on around EC50)



            ggplot(dat, aes(x = dose, y = response)) +
            stat_function(fun = function(x, b, c, d, e){
            c + (d - c)/(1 + exp(b*(log(x) - log(e))))
            }, args = coefs, col = "skyblue", lwd = 1) +
            geom_point(pch = 21, fill = "white") +
            geom_hline(yintercept = coefs[c("c", "d")], lty = 2, colour = "gray50") +
            geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
            lty = 2, colour = "gray50") +
            geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
            lty = 2, colour = "gray50") +
            scale_x_log10(
            breaks = scales::trans_breaks("log10", function(x) 10^x),
            labels = scales::trans_format("log10", scales::math_format(10^.x))
            ) +
            annotation_logticks(sides = "b") +
            labs(x = "Dose",
            y = "Response"
            ) +
            expand_limits(y = 1) +
            ggthemes::theme_few()


            drm







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 16 '18 at 15:57









            utubunutubun

            1,8351914




            1,8351914

























                0














                try this :



                library(drc)

                #adjust model
                drm <- drm(Response ~ Conc, data = df, fct = LL.4())

                #plot
                plot(drm)
                abline(a=112.6868 , 0)


                enter image description here






                share|improve this answer




























                  0














                  try this :



                  library(drc)

                  #adjust model
                  drm <- drm(Response ~ Conc, data = df, fct = LL.4())

                  #plot
                  plot(drm)
                  abline(a=112.6868 , 0)


                  enter image description here






                  share|improve this answer


























                    0












                    0








                    0







                    try this :



                    library(drc)

                    #adjust model
                    drm <- drm(Response ~ Conc, data = df, fct = LL.4())

                    #plot
                    plot(drm)
                    abline(a=112.6868 , 0)


                    enter image description here






                    share|improve this answer













                    try this :



                    library(drc)

                    #adjust model
                    drm <- drm(Response ~ Conc, data = df, fct = LL.4())

                    #plot
                    plot(drm)
                    abline(a=112.6868 , 0)


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 16 '18 at 14:59









                    Jrakru56Jrakru56

                    609212




                    609212























                        0














                        You can extract the value of the asymptote from the drm object:



                        asymptote <- coef(drm)[3]


                        This value can be used for plotting:



                        plot(drm)
                        abline(asymptote, 0)


                        enter image description here






                        share|improve this answer




























                          0














                          You can extract the value of the asymptote from the drm object:



                          asymptote <- coef(drm)[3]


                          This value can be used for plotting:



                          plot(drm)
                          abline(asymptote, 0)


                          enter image description here






                          share|improve this answer


























                            0












                            0








                            0







                            You can extract the value of the asymptote from the drm object:



                            asymptote <- coef(drm)[3]


                            This value can be used for plotting:



                            plot(drm)
                            abline(asymptote, 0)


                            enter image description here






                            share|improve this answer













                            You can extract the value of the asymptote from the drm object:



                            asymptote <- coef(drm)[3]


                            This value can be used for plotting:



                            plot(drm)
                            abline(asymptote, 0)


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 16 '18 at 15:03









                            Sven HohensteinSven Hohenstein

                            66.7k12100132




                            66.7k12100132






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339882%2fplot-asymptote-in-grotwth-curve-in-r%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Bressuire

                                Vorschmack

                                Quarantine