I'm trying to find the parameters of a distribution which fits to truncated data.
There's a similar unanswered post here: Fit a statistical distribution to truncated data
# Generate truncated data, x ~ N(3, 1) and x <= 2
N <- 10000
trunc <- rnorm(N, mean = 3, sd = 1)
trunc <- trunc[which(trunc <= 2)]
print(fitdistr(trunc, densfun = 'normal'))
> mean sd
> 1.479185403 0.426895843
> (0.010695819) (0.007563086) # does not return mean 3 and sd 1
The above code generated an illustration with x drawn from N(3, 1) but truncated above 2. Can I recover the original normal distribution with fitdistr
or fitdistrplus
?
That is the other way round.
{extraDistr}
is made for this. For details look at the documentation, e.g.?rtnorm
.Then you could use this answer from @jdblood94.