From 2d4f24734d7525c48c4244b70df247a685a03615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lie=20Siberchicot?= Date: Fri, 16 Feb 2024 15:25:27 +0100 Subject: [PATCH] Update the 'descdist' function to reduce the time taken to display 'lines' --- R/descdist.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/descdist.R b/R/descdist.R index b1bec9b7..19587188 100644 --- a/R/descdist.R +++ b/R/descdist.R @@ -132,14 +132,14 @@ descdist <- function(data, discrete = FALSE, boot = NULL, method = "unbiased", shape<-exp(lshape) s2<-4/shape y<-kurtmax-(3+6/shape) - lines(s2,y,lty=2, xlim=c(0,xmax),ylim=c(0,ymax)) + lines(s2[s2<=xmax],y[s2<=xmax],lty=2) # lnorm dist lshape<-seq(-100,100,0.1) shape<-exp(lshape) es2<-exp(shape^2) s2<-(es2+2)^2*(es2-1) y<-kurtmax-(es2^4+2*es2^3+3*es2^2-3) - lines(s2,y,lty=3,xlim=c(0,xmax),ylim=c(0,ymax)) + lines(s2[s2<=xmax],y[s2<=xmax],lty=3) legend(xmax*0.55, ymax*1.03,legend="Theoretical",bty="n",cex=0.8) legend(xmax*0.6, ymax*0.98,pch=8,legend="normal",bty="n",cex=0.8) @@ -189,7 +189,7 @@ descdist <- function(data, discrete = FALSE, boot = NULL, method = "unbiased", lambda<-exp(llambda) s2<-1/lambda y<-kurtmax-(3+1/lambda) - lines(s2,y,lty=2, xlim=c(0,xmax),ylim=c(0,ymax)) + lines(s2[s2<=xmax],y[s2<=xmax],lty=2) } # bootstrap sample for observed distribution if (!is.null(boot)) {