Dear Lorenzo,

Please do read the posting guide (https://www.r-project.org/posting-guide.html) 
: The ‘main’ R mailing list, for discussion about problems and solutions using 
R, about the availability of new functionality for R and documentation of R, 
comparison and compatibility with S-plus, and for the posting of nice examples 
and benchmarks.


For your problem, you could do something like this

x <- rbeta(1000, 3, 3)

dbeta2 <- function(x, shape, ...)
        dbeta(x, shape, shape, ...)
pbeta2 <- function(q, shape, ...)
        pbeta(q, shape, shape, ...)     
        
library(fitdistrplus)
fitdist(x, "beta2", start=list(shape=1/2))

x <- rbeta(1000, .3, .3)
fitdist(x, "beta2", start=list(shape=1/2), optim.method="L-BFGS-B", lower=1e-2) 
 
Regards, Christophe
---------------------------------------
Christophe Dutang
LMM, UdM, Le Mans, France
web: http://dutangc.free.fr

> Le 23 mai 2017 à 18:22, Lorenzo Isella <lorenzo.ise...@gmail.com> a écrit :
> 
> Dear All,
> In principle it is a simple question, but not idea about how to tackle
> it.
> Suppose you have a distribution depending on two parameters,
> e.g. beta(a,b).
> For some reasons, you want to impose
> that the two parameters of the beta distribution are identical,
> i.e. you want to fit your data to beta(a,a).
> For instance
> 
> x<-rbeta(1000, 0.1, 0.1)
> require(fitdistrplus)
> 
> mm<-fitdist(x, "beta",  method = "mge")
> 
> 
> is how you would normally fit a sample, but I do not know how to
> impose the constrain a=b before the fitting.
> Any suggestion is appreciated.
> Cheers
> 
> Lorenzo

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to