Re: fit with cdf of skew normal distriubtion
- To: mathgroup at smc.vnet.net
- Subject: [mg112158] Re: fit with cdf of skew normal distriubtion
- From: Ray Koopman <koopman at sfu.ca>
- Date: Fri, 3 Sep 2010 06:06:57 -0400 (EDT)
- References: <i5l9qr$7h9$1@smc.vnet.net>
On Sep 1, 3:27 am, Tom Pether <peth... at googlemail.com> wrote:
> Hi,
>
> to am trying to fit the integral of the skew normal distribution to a
> set of data. xhis is my fit function:
Why are you doing least-squares fitting to the cdf? Why not get
initial estimates by fitting the first three moments of the data,
and then use maximum likelihood to get better estimates?
>
> upperlimit[x_, y0_, p2_, a_] = p2 (1 - (x/y0)^(1/a));
> f[x_, y0_, a_, p2_, s_, skew_, A_, b_, p_] :=
> b - 2 A NIntegrate[
> PDF[NormalDistribution[p, s], x] CDF[
> NormalDistribution[p*skew, s], (skew*x)], {x, -100,
> uperlimit[x, y0, p2, a]}, MaxPoints -> 200, MaxRecursion -> 6,
> PrecisionGoal -> 4];
>
> then i call the fit by
>
> FitResult =
> NonlinearModelFit[data, f[x, y0, a, p2, s, skew, A, b, p], init,
> {index, t},
> Weights -> weights, VarianceEstimatorFunction -> Automatic,
> PrecisionGoal -> 4];
>
> if i then want to get error estimates for the fit parameters by calling
>
> FitResult["ParameterTable"]
>
> i get the following error messages (and no error estimates):
>
> General::stop: Further output of NIntegrate::nlim will be suppressed
> during this calculation. >>
>
> Function::slotn: Slot number 2 in
> FittedModels`NonlinearFitDump`cnf[{T0,a,pc,s,skew},<<1>>,{},Sequence@@{WorkingPrecision->MachinePrecision}]/.FittedModels`NonlinearFitDump`cnf-><<36>>&
> cannot be filled from (<<1>>)[##1]. >>
>
> Function::slotn: Slot number 2 in
> FittedModels`NonlinearFitDump`cnf[{T0,a,pc,s,skew},<<1>>,{},Sequence@@{WorkingPrecision->MachinePrecision}]/.FittedModels`NonlinearFitDump`cnf-><<36>>&
> cannot be filled from (<<1>>)[##1]. >>
>
> Power::infy: Infinite expression 1/0. encountered. >>
>
> Power::infy: Infinite expression 1/0. encountered. >>
>
> Power::infy: Infinite expression 1/0. encountered. >>
>
> General::stop: Further output of Power::infy will be suppressed during
> this calculation. >>
>
> \[Infinity]::indet: Indeterminate expression 0. ComplexInfinity
> encountered. >>
>
> \[Infinity]::indet: Indeterminate expression 0. ComplexInfinity
> encountered. >>
>
> \[Infinity]::indet: Indeterminate expression 0. ComplexInfinity
> encountered. >>
>
> General::stop: Further output of \[Infinity]::indet will be suppressed
> during this calculation. >>
>
> does anybody have any idea how to fix this? if i do a fit with
> CDF[NormalDistribution...] it works well. with my "self made" CDF f[] it
> doesn't... i am stuck here. thanks in advance
>
> tom