Skip to content
Notifications
Clear all

Multi-key ranking

11 Posts
4 Users
0 Reactions
2,000 Views
Avatar
Posts: 10
Customer
Topic starter
(@ddb8zvbjy5qer2dwyzwynjlpc543)
Active Member
Joined: 3 years ago

I am trying to get ranking using two keys; a primary one (which has ties) and a secondary one to break the ties.  Docs.analytica.com gives this example:  

Index keyIndex := ['age', 'gender'];
Rank(Array(keyIndex, [age, gender]), i, keyIndex)

In this example, the third argument to Rank seems to be an index called keyIndex. 

But when I try to get this working in my code, I get an error message:  Evaluation error in Proj_ranks:  In call to function Rank, the third parameter, <<tyoe>>, should be numeric ...

I think the documentation is off, because a subsequent example shows keyIndex: being used as a keyword, and it is followed by a reference to the index, which has some other name.  When I use keyIndex: as a keyword, it seems to work for me.

10 Replies
Avatar
Posts: 9
Admin
(@dpaine)
Member
Joined: 5 years ago

Yes the documentation is off. Thanks for reporting this. I will change the docs.

In the function rank, type: is the optional numeric 3rd parameter, with default value -1. keyIndex: is the optional 4th parameter.

In the example given here Index keyIndex := ['age', 'gender'];Rank(Array(keyIndex, [age, gender]), i, keyIndex)

With the the optional 3rd parameter not specified the 4th keyIndex parameter must be named like so; Index keyIndex := ['age', 'gender'];Rank(Array(keyIndex, [age, gender]), i, keyIndex: keyIndex)

You mention a subsequent example I think you may mean this:

Rank(NumMaintEvents, CarNum, keyIndex: maintType: RankType)

In this example keyIndex: is the parameter's name with the value being the index maintType. keyIndex: is named since it is out of order. RankType: is the type: parameter and is not named here but it should be - i.e. type: RankType - since it also is out of order.

There is an example model which contains some of the example variables on this page: Look at rank function examples in the array functions/array transforming module here.

C:\Program Files\Lumina\Analytica 6.4\Example Models\User Guide Examples\Array Function Examples.ana

Reply
Avatar
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 9 months ago

help meeee

Reply
Avatar
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 9 months ago

pak cepat cepat jeder

Reply
Avatar
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 9 months ago

ahhuhh   ahhhh

Reply
Page 1 / 3
Share:

Download the free edition of Analytica

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


    Analytica Cubes Pattern

    Download the free edition of Analytica

    The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

    While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


      Analytica Cubes Pattern