Skip to content

Commit

Permalink
add example for Issue 33
Browse files Browse the repository at this point in the history
  • Loading branch information
dutangc committed Oct 18, 2024
1 parent 3086429 commit 930eb72
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ fitdistrplus.Rproj
inst/doc/
revdep
fitdistrplus-github.Rproj
share/todolist.html
share/todolist.html
AUTHORS
LICENSE
47 changes: 47 additions & 0 deletions share/pb-exists-envir-primarycensored.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

install.packages(
"primarycensored",
repos = "https://epinowcast.r-universe.dev"
)

library(primarycensored)
?fitdistdoublecens

set.seed(123)
n <- 1000
true_mean <- 5
true_sd <- 2
pwindow <- 2
swindow <- 2
D <- 10
samples <- rprimarycensored(
n, rnorm,
mean = true_mean, sd = true_sd,
pwindow = pwindow, swindow = swindow, D = D
)
#etrange comme tirage
table(samples)

delay_data <- data.frame(
left = samples,
right = samples + swindow
)

fit_norm <- fitdistdoublecens(
delay_data,
distr = "norm",
start = list(mean = 0, sd = 1),
D = D, pwindow = pwindow
)

head(delay_data)

curve(pprimarycensored(x, pnorm, mean = 0, sd = 1, D=D, pwindow=pwindow), from=-5, to=10)
lines(ecdf(samples))

#c'est tres voisin de fitdistcens...
fitdistcens(delay_data, "norm")

fitdistcens(delay_data, dnorm)


0 comments on commit 930eb72

Please sign in to comment.