[R] Error : 'start' contains NA values when fitting frank copula
Soumen Banerjee
@oumen08 @end|ng |rom gm@||@com
Sun Apr 22 01:51:41 CEST 2018
Hi Martin,
Thanks for the reply. I tried to make a toy example so that I could get the
same error. I have attached the data file for which the error occurs in my
program.
The code after loading this file is -
fr_cop = frankCopula(dim=6)
fit_fr_cop = fitCopula(fr_cop,pobs(data),method="mpl")
This is about looking for the degree of monetary independence between a
country and large economies. In this data, the "this" country is UK, so
that there are two columns which are exactly equal, but there are 4 other
columns which aren't. Is this a valid case?
Soumen
On Sun, Apr 22, 2018 at 1:46 AM, Martin Maechler <maechler using stat.math.ethz.ch
> wrote:
> >>>>> Soumen Banerjee <soumen08 using gmail.com>
> >>>>> on Sat, 21 Apr 2018 17:22:56 +0800 writes:
>
> > Hello! I am trying to fit a copula to some data in R and
> > I get the error mentioned above. This is the code for a
> > reproducible example -
>
> (not really reproducible: You did not set the random seed, so
> the data is different every time;
> OTOH, yes, the following always gives an error)
>
> > library(copula)
>
> Slightly clearer showing what you are doing:
>
> x <- runif(200)
> data <- cbind(x, 2*x, 3*x)
>
> > fr_cop = frankCopula(dim=3)
> > fit_fr_cop = fitCopula(fr_cop, pobs(data), method = "mpl") #Error
> Here
>
> > The error says : Error in fitCopula.ml(copula, u = data, method =
> method,
> > start = start, : 'start' contains NA values
>
> > What could be going wrong?
>
> Is this a homework question? [probably not, but ..]
>
> The homework question & answer would be
>
> Q: What is the best fitting 3D copula if you have perfectly
> correlated ("rank 1") data?
>
> A: The complete-dependence copula ... which is indeed a boundary case,
> hard to imagine you'd encounter for non-artifical data.
>
> Another hint:
>
> > fitCopula(normalCopula(,3), pobs(data))
> Call: fitCopula(copula, data = data)
> Fit based on "maximum pseudo-likelihood" and 200 3-dimensional
> observations.
> Copula: normalCopula
> rho.1
> 1
> The maximized loglikelihood is 3686
> Optimization converged
> >
> -----------
>
> Yes, one could adapt the fitCopula() code to work better for
> this extreme boundary case,
> and for the Frank copula, it would return
>
> > fitCopula(frankCopula(,3), pobs(data))
> Call: fitCopula(copula, data = data)
> Fit based on "maximum pseudo-likelihood" and 200 3-dimensional
> observations.
> Copula: frankCopula
> alpha
> 7.21e+16
> The maximized loglikelihood is 1.798e+308
> Optimization converged
>
>
> but it would need even more tweaking to also give such
> "alpha ~= +Inf"
> results for other cases such as Gumbel or Joe.
>
> I may add the possibility for frank*() as shown above for the
> next release of the copula package...
> but am a bit hesitant to complicate (and slowdown) the current
> code by adding an extra check for this situation.
>
> Martin Maechler
> ETH Zurich
>
More information about the R-help
mailing list