GithubHelp home page GithubHelp logo

drda's Issues

[BUG] Error plotting: Error in seq.default(x1, x2, by = ceiling((x2 - x1)/6)) : invalid '(to - from)/by'

Describe the bug

Thanks for this package! I noticed the above bug. When the input data frame is not sorted by dose, the plot utility does not work under base != 'n'.

To Reproduce

library(tidyverse)
library(drda)
voropm2 <- voropm2 %>% arrange(desc(dose))
fit <- drda(response ~ dose, data = voropm2,mean_function='loglogistic5',max_iter = 10000)
plot(fit,base="10")

yields:

Error in seq.default(x1, x2, by = ceiling((x2 - x1)/6)) : 
  invalid '(to - from)/by'

Expected behavior

I expect the sorting of the data frame to not impact results/plots generated. Right now I can work around the issue by sorting dataframes passed to the package, but this should probably be documented and eventually corrected.

Desktop (please complete the following information):

  • OS: macOS
  • Platform: aarch64-apple-darwin20 (64-bit)
  • R: 4.2.1
  • drda version: [e.g. 2.0.1]

Getting distorted curves when attempting to plot multiple curves in the same plot

Thanks @albertopessia for this user-friendly and well-documented package.

When I try to plot multiple dose-response curves in the same plot, the curves get distorted - due to change(s) in x or y axes. Consider the following example:

# Data
dose <- c( -4, -4.30, -4.60, -4.90, -5.20, -5.50, -5.80, -6.10, -6.40, -6.70, -7)
response <- c(3, 10, 24, 32, 45, 58, 71, 88, 92, 95, 99)

# Model 1
m1 <- drda(formula = response ~ dose, mean_function = "logistic4")

# Model 2
low_bound <- c(0, 100, -7, -Inf)
up_bound <- c(0, 100, -4, Inf)
m2 <- drda(formula = response ~ log_dose, upper_bound = up_bound, lower_bound = low_bound)

# Plot
plot(m1, m2) 

example_1

Defining axis limits appears to be the only working solution:

plot(m, m2, 
        xlim = c(-7, .4), 
        ylim = c(0, 100), 
        legend = c("Model_1", "Model_2")) 

example_2

Is there something obvious I am missing here or is this the expected behavior?

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS  10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] pracma_2.3.3 drda_1.0.0  

loaded via a namespace (and not attached):
 [1] fansi_0.5.0      assertthat_0.2.1 dplyr_1.0.7      crayon_1.4.1     utf8_1.2.2      
 [6] grid_4.0.2       R6_2.5.1         DBI_1.1.1        lifecycle_1.0.1  gtable_0.3.0    
[11] magrittr_2.0.1   scales_1.1.1     pillar_1.6.4     ggplot2_3.3.5    rlang_0.4.11    
[16] generics_0.1.0   vctrs_0.3.8      ellipsis_0.3.2   tools_4.0.2      glue_1.4.2      
[21] purrr_0.3.4      munsell_0.5.0    tinytex_0.34     xfun_0.26        compiler_4.0.2  
[26] pkgconfig_2.0.3  colorspace_2.0-2 tidyselect_1.1.1 tibble_3.1.5  

[BUG]nauc() function

Hello

I am trying to use the nauc() function but get the following message

Error in if (tmp < xlim[2]) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In log((ylim[2] - alpha)/(beta - ylim[2])) : NaNs produced.

issue with plotting

Thank you so much for providing this nice package.

I have some issues with plotting.

  • I generated a 4 parametric fit of this data x:

    Compound	Cell	conc	GI	relGI
    drug1	MDAMB436	1,00E-09	94,12125	0,9412125
    drug1	MDAMB436	5,00E-09	89,76748	0,8976748
    drug1	MDAMB436	1,67E-08	79,58089	0,7958089
    drug1	MDAMB436	5,00E-08	72,59264	0,7259264
    drug1	MDAMB436	1,67E-07	67,35769	0,6735769
    drug1	MDAMB436	5,00E-07	53,64598	0,5364598
    drug1	MDAMB436	1,67E-06	33,58508	0,3358508
    drug1	MDAMB436	5,00E-06	30,55685	0,3055685
    drug1	MDAMB436	5,00E-05	15,06649	0,1506649
    

    lb <- c(1, -1, -Inf, -Inf)
    ub <- c(1, Inf, Inf, Inf)
    fit=drda::drda(x$rel.gi ~ log10(x$conc),
    mean_function = "logistic4",
    lower_bound = lb,
    upper_bound = ub))

  • summary of the fit:
    > summary(fit)

      Call: drda::drda(formula = x$rel.gi ~ log10(x$conc), mean_function = "logistic4", 
          lower_bound = lb, upper_bound = ub)
      
      Pearson Residuals:
          Min       1Q   Median       3Q      Max  
      -1.6240  -0.4998   0.1265   0.4788   1.2993  
      
      Parameters:
                        Estimate Std. Error Lower .95 Upper .95
      Maximum            1.00000         NA        NA        NA
      Height            -0.96278    0.07109  -1.10211    -0.823
      Growth rate        1.02122    0.11853   0.78890     1.254
      Midpoint at       -6.31416    0.19131  -6.68913    -5.939
      Residual std err.  0.03325    0.01108   0.01153     0.055
      
      Residual standard error on 6 degrees of freedom
      
      Log-likelihood: 19.687
      AIC: -31.374
      BIC: -30.585
      
      Optimization algorithm converged in 289 iterations
    
  • plotting fails with error:

    plot(fit)
    Error in crossprod(G[i, ], V) : non-conformable argument

    8.crossprod(G[i, ], V) at curve_variance.R#31
    7.tcrossprod(crossprod(G[i, ], V), G[i, ]) at curve_variance.R#31
    6.curve_variance.drda(x, xx) at S3.R#50
    5.curve_variance(x, xx) at plot.R#547
    4.plot_params.logistic(x, dotargs[["base"]], dotargs[["xlim"]],
    dotargs[["ylim"]]) at S3.R#62
    3.plot_params(x, dotargs[["base"]], dotargs[["xlim"]], dotargs[["ylim"]]) at plot.R#99
    2.plot.drda(fit)
    1.plot(fit)

Please let me know if you need more details.

Get standard error from predict

thanks for this package. It’s working well for me…

But is there any way to get standard error from predictions on a drda fit object (eg, predict(fit, se.fit=T) ).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.