Re: simple question

• To: mathgroup at smc.vnet.net
• Subject: [mg105233] Re: simple question
• From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
• Date: Wed, 25 Nov 2009 02:32:05 -0500 (EST)
• References: <hegf08\$1g1\$1@smc.vnet.net>

```Hi Fransisco,

It can be done rather easy using Gather:

In[31]:= myGather[list_List, places_List] :=
Gather[list, (#1[[places]] == #2[[places]]) &]

In[32]:= myGather[ejemplo1, {4, 5}]

Out[32]= {{{1, 0, 2, 2, 0}}, {{0, 1, 1, 1, 2}, {2, 1, 1, 1, 2}}, {{2,
0, 0, 1, 1}, {2, 2, 0, 1, 1}}, {{1, 1, 0, 2, 2}}, {{1, 0, 2, 0,
1}, {0, 1, 1, 0, 1}}}

In[33]:= myGather[ejemplo1, {1, 4, 5}]

Out[33]= {{{1, 0, 2, 2, 0}}, {{0, 1, 1, 1, 2}}, {{2, 0, 0, 1, 1}, {2,
2, 0, 1, 1}}, {{1, 1, 0, 2, 2}}, {{1, 0, 2, 0, 1}}, {{2, 1, 1, 1,
2}}, {{0, 1, 1, 0, 1}}}

In[34]:= myGather[ejemplo1, {1}]

Out[34]= {{{1, 0, 2, 2, 0}, {1, 1, 0, 2, 2}, {1, 0, 2, 0, 1}}, {{0, 1,
1, 1, 2}, {0, 1, 1, 0, 1}}, {{2, 0, 0, 1, 1}, {2, 2, 0, 1, 1}, {2,
1, 1, 1, 2}}}

Cheers -- Sjoerd

On Nov 24, 1:11 pm, Francisco Gutierrez <fgutiers2... at yahoo.com>
wrote:
> Dear List:
> I have the following list:
> ejemplo1={{1,0,2,2,0},{0,1,1,1,2},{2,0,0,1,1},{1,1,0,2,2},{1,0,2,0,1},{2,2,0,1,1},{2,1,1,1,2},{0,1,1,0,1}};
> I want to group it, so that the sublists of ejemplo1 that have identical values at positions 4 and 5 are gathered together. So I did the following code:
> Split[ Sort[ejemplo1,#1[[4]]>=#2[[4]] && #1[[5]]>=#2[[5]] &],Take[#1, {4,5}]==Take[#2,{4,5}]&]
>
> Works! The output in effect is:
> {{{1,1,0,2,2}},{{0,1,1,1,2},{2,1,1,1,2}},{{2,0,0,1,1},{2,2,0,1,1}},{{1,0,2,0,1},{0,1,1,0,1}},{{1,0,2,2,0}}},
> precisely what I wanted.
>
> Now, how can I create a function for the general case (instead of fixed positions 4 and 5, an arbitrary number of positions that act as "gathering parameter")?
> Fg
>
> --- On Mon, 11/23/09, Petri T=F6tterman <petri.totter... at hanken.fi> wrote:
>
> From: Petri T=F6tterman <petri.totter... at hanken.fi>
> Subject:  ML estimators for Box-Cox Extreme Value distribution
> Date: Monday, November 23, 2009, 6:53 AM
>
> Dear all,
>
> I have a set of data, and I want to fit a distribution on this data. I
> am particularily interested in the Box-Cox General Extreme Value
> distribution, for which I have the CDF and PDF:
> ---
> BoxCoxGEVDistribution /:
>
>    CDF[BoxCoxGEVDistribution[\[Mu]_, \[Sigma]_, \[Xi]_, \[Phi]_], x_]:=
>     1 + (((Exp[-(1 + \[Xi] ( (x - \
> \[Mu])/\[Sigma]))^(-1/\[Xi])])^\[Phi]) - 1)/\[Phi];
>
> BoxCoxGEVDistribution /:
>
>    PDF[BoxCoxGEVDistribution[\[Mu]_, \[Sigma]_, \[Xi]_, \[Phi]_], x_] =
>     D[CDF[BoxCoxGEVDistribution[\[Mu], \[Sigma], \[Xi], \[Phi]], x],
>     x];
> ---
>
> I do also have a Log likelihood function from (Bali, 2007):
>
> ---
> LLdBoxCoxGEV[\[Mu]_, \[Sigma]_, \[Xi]_, \[Phi]_, M_] :=
>    Module[{k = Length[M]}, -k Log[\[Sigma]] -
>      k ((1 + \[Xi])/\[Xi]) Sum[
>        Log[1 + \[Xi] ((M[[i]] - \[Mu])/\[Sigma])], {i, 1, k}] -
>      k \[Phi] Sum[(1 + \[Xi] ((M[[i]] - \[Mu])/\[Sigma]))^(-(
>         1/\[Xi])), {i, 1, k}] ];
> ---
>
> Obviously, \[Mu]_, \[Sigma]_, \[Xi]_, \[Phi]_ are parameters which I
> need to estimate, and M is a list of values from the dataset,
> exceeding a predefined limit.
>
> I would be grateful for advice, how should I continue to find the
> Maximum Likelihood estimators for this distribution, using Mathematica?
>
> Best regards,
> /petri

```

• Prev by Date: Re: Solving systems of differential equations
• Next by Date: Re: simple question
• Previous by thread: Re: simple question
• Next by thread: Re: Re: simple question