error in fitdistr

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

error in fitdistr

lkhodakarim
Hi dear,

I want to estimate d.f for Chi-squared distribution:

est.chi[i,]<-c(
fitdistr(as.numeric(data2[,i]),"chi-squared",start=list(df=1))$estimate)Warning
message:In optim(x = c(7.86755, 7.50852, 7.86342, 7.70589, 7.70153,
7.58272,  :
  one-diml optimization by Nelder-Mead is unreliable:
use "Brent" or optimize() directly


Who can help me to solve this problem?

Best whishes,
Soheila

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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 | Threaded
Open this post in threaded view
|

Re: error in fitdistr

Mark Difford
On Feb 23, 2012 at 11:19am Soheila wrote:

> Who can help me to solve this problem?
> est.chi[i,]<-c( fitdistr(as.numeric(data2[,i]),"chi-squared",start=list(df=1))$estimate)
> Warning message:In optim(x = c(7.86755, 7.50852, 7.86342, 7.70589, 7.70153, 7.58272,  :  one-diml optimization by
> Nelder-Mead is unreliable: use "Brent" or optimize() directly

The warning message tells you to use "Brent" rather than the default Nelder-Mead. So do that.

##
?optim
est.chi[i,]<-c( fitdistr(as.numeric(data2[,i]), densfun="chi-squared", start=list(df=1), method="Brent")$estimate)

Regards, Mark.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa