Skip to content

Commit

Permalink
Update the 'descdist' function and uncomment examples that contain th…
Browse files Browse the repository at this point in the history
…is function: limit the display of 'lines()' to the graph boundaries
  • Loading branch information
aursiber committed Feb 16, 2024
1 parent 04fad4e commit 619d32e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
9 changes: 4 additions & 5 deletions R/descdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
Expand Down Expand Up @@ -132,15 +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)
lines(s2,y,lty=2, xlim=c(0,xmax),ylim=c(0,ymax))
# 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)

lines(s2,y,lty=3,xlim=c(0,xmax),ylim=c(0,ymax))

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)
Expand Down Expand Up @@ -190,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)
lines(s2,y,lty=2, xlim=c(0,xmax),ylim=c(0,ymax))
}
# bootstrap sample for observed distribution
if (!is.null(boot)) {
Expand Down
18 changes: 9 additions & 9 deletions man/descdist.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,33 @@ Marie-Laure Delignette-Muller and Christophe Dutang.
#
set.seed(1234)
x1 <- rnorm(100)
# descdist(x1)
# descdist(x1,boot=11)
descdist(x1)
descdist(x1,boot=11)
# (2) Description of a sample from a beta distribution
# with uncertainty on skewness and kurtosis estimated by bootstrap
# with changing of default colors and plotting character for observed point
#
# descdist(rbeta(100,shape1=0.05,shape2=1),boot=11,
# obs.col="blue", obs.pch = 15, boot.col="darkgreen")
descdist(rbeta(100,shape1=0.05,shape2=1),boot=11,
obs.col="blue", obs.pch = 15, boot.col="darkgreen")
# (3) Description of a sample from a gamma distribution
# with uncertainty on skewness and kurtosis estimated by bootstrap
# without plotting
#
# descdist(rgamma(100,shape=2,rate=1),boot=11,graph=FALSE)
descdist(rgamma(100,shape=2,rate=1),boot=11,graph=FALSE)
# (4) Description of a sample from a Poisson distribution
# with uncertainty on skewness and kurtosis estimated by bootstrap
#
# descdist(rpois(100,lambda=2),discrete=TRUE,boot=11)
descdist(rpois(100,lambda=2),discrete=TRUE,boot=11)
# (5) Description of serving size data
# with uncertainty on skewness and kurtosis estimated by bootstrap
#
# data(groundbeef)
# serving <- groundbeef$serving
# descdist(serving, boot=11)
data(groundbeef)
serving <- groundbeef$serving
descdist(serving, boot=11)
}
\keyword{ distribution }
2 changes: 1 addition & 1 deletion man/endosulfan.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data(endosulfan)
#
log10ATV <-log10(subset(endosulfan,(Australian == "no") & (group == "Fish"))$ATV)
plotdist(log10ATV)
# descdist(log10ATV,boot=11)
descdist(log10ATV,boot=11)

# (3) fit of a normal and a logistic distribution to data in log10
# (classical distributions used for SSD)
Expand Down
2 changes: 1 addition & 1 deletion man/groundbeef.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data(groundbeef)
# (2) description and plot of data
#
serving <- groundbeef$serving
# descdist(serving)
descdist(serving)
plotdist(serving)

# (3) fit of a Weibull distribution to data
Expand Down
2 changes: 1 addition & 1 deletion man/toxocara.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data(toxocara)
# (2) description and plot of data
#
number <- toxocara$number
# descdist(number, discrete = TRUE, boot = 11)
descdist(number, discrete = TRUE, boot = 11)
plotdist(number, discrete = TRUE)

# (3) fit of a Poisson distribution to data
Expand Down

0 comments on commit 619d32e

Please sign in to comment.