-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tarmo Veskioja <[EMAIL PROTECTED]> writes:
> Your cr is called the absolute consistency index (CI). What Coyle
> refers to is called relative consistency ratio (CR). From Coyle's
Thanks. I keep learning.
> So you need to do
> CR = CI % MACI, where MACI is a mean absolute consistency index of
> random matrices.
See the attached code.
> Saaty and others have MACI precomputed for matrices up to size 10.
> NB. MACI based on 1 000 000 random matrices
> 3 4 5 6 7 8
> 9 10
> 0.524500 0.884133 1.10857 1.24902 1.34039 1.40437 1.45050 1.48607
> The 0.5245 for 3x3 matrices is exact.
>
> One can use Roger's code for generating random matrices (I had to put
> back the dot behind y, since I still use J5.04):
Even when you said it, I glossed over it and spent a few minutes
wondering what I had copied out of Roger's email incorrectly. I _knew_
I wasn't going to like x and y! :-)
> Then you can use something like
> (cr exp) % (<:<:#exp) {maci_precomputed NB. relative consistency ratio for
> exp
Don't you want one more <:?
Try this:
......................................................................
NB. A program to apply Saaty's method in an interactive fashion.
NB. according to the link in http://actifeld.com/A%20Possible%20Method.doc
NB. 2006-03-02
NB. John Randall developed the basic algorithm on the J Programming Forum
NB. Raul Miller, Tarmo Veskioja, Devon McCormick, and Roger Hui contributed to
the dialog
NB. Bill Harris put a few other pieces on.
NB. The steps:
NB. Define the Client Preference Matrix as described on p. 6 of that article
NB. Run (%+/)power on that matrix to find the principle eigenvector.
NB. Run cr to calculate the Consistency Ratio; if it is much in excess of
NB. 0.1, the judgments used to create the CPM are probably too random.
NB. Create preference matrices for each of the alternatives on each of
NB. the dimensions used in the CPM. Calculate the principal eigenvectors
NB. and consistency ratio for each.
NB. Create the Option Performance Matrix by assembling all the principal
NB. eigenvectors for the preference matrices.
NB. Multiply OPM time CVV to get the Value For Money vector.
NB. Calculate principal eigenvectors of the matrix cpm by
NB. (%+/) power cpm
NB. Calculate the principal eigenvalue of the matrix cpm by
NB. ev cpm
NB. Calculate the relative consistency ratio of the matrix cpm by
NB. cr cpm
NB. The VFM shows in each position the relative preference the decision-maker
NB. has shown for that alternative: OPM * CVV = VFM
NB. If the Option Performance Matrix is
NB. opm=: |:a,b,c,:d
NB. where a, b, c, and d are the principal eigenvectors of each option matrix
NB. then
NB. (%/+)opm mp cpm
NB. is the Value For Money (VFM) matrix, giving the relative
NB. values of each alternative
NB. The power method for calculating the principal eigenvector
mp=:+/ . *
normalize=:%(>./@:|)
iterate=:normalize@:mp
init=:[: ? # # 0:
power=:13 : 'y.&iterate^:_ init y.'
NB. Calculate the principal eigenvalue
NB. Postmultiply the current principal eigenvector by the matrix
NB. Divide that vector (unnormalized) by the principal eigenvector
NB. See p. 258 of Kincaid and Cheney's Numerical Analysis 3rd edition
cureigenvec =: (%+/) @: power
neweigenvec =: mp cureigenvec
ev=: [: {. neweigenvec % cureigenvec
NB. Calculate the absolute consistency index
ci =: (ev - #) % <: @: #
NB. Calculate the consistency ratio
NB. MACI is the mean absolute consistency index of random matrices
am=: +/%#
maci =: 13 : 'am ci"2 st1"0 (x. # y.)'
maci_precomputed =: 1000 maci"0 (3+i.8) NB. Tarmo claims it's exactly 0.5245
for 3
index =: <:^:3 & #
maciv =: 13 : '(index y.) { maci_precomputed' NB. Get the value of
cr=: ci % maciv
NB. .........................................................................
NB. Random Saaty matrices for testing
NB. st is Tarmo Veskioja's verb (e.g., st 4)
NB. st1 is Roger Hui's faster but more space-intensive equivalent
saaty_scale =: \:~ }. (,%)~ >:i.9
str =: 13 : '( =/~ i.#y.) + (y.*bd ) + |: (bd=. >/~ i.#y.) * %y.'
saaty_rand =: 13 : '(y. , y.) $ saaty_scale {~ ? (#saaty_scale) #~ *: y.'
st =: 13 : 'str saaty_rand y.' NB. st 4
st1=: 3 : 0
i=. 1+(,~y.) [EMAIL PROTECTED] #saaty_scale
b=. >/~i.y.
((b*i) + |:b*i+#saaty_scale) { 1,(,%) saaty_scale
)
NB. Test matrices from Geoff Coyle's paper referenced above:
NB. peigen s/b 0.232,0.402,0.061,0.305, cr of 0.055
cpm=: >(1,(%3),5, 1);(3,1,5,1);((%5),(%5),1,(%5));(1,1,5,1)
NB. peigen s/b 0.751,0.178,0.071 w/ cr of 0.072
exp=: >(1,5,9);((%5),1,3);((%9),(%3),1) NB. Expenses
NB. peigen s/b 0.480,0.406,0.114 w/ cr of 0.026
und=: >(1,1,5);(1,1,3);((%5),(%3),1) NB. "Understandability
NB. peigen s/b 0.077,0.231,0.692 w/ cr of 0
rod=: >(1,(%3),%9);(3,1,%3);9 3 1 NB. "Replication of detail", p. 7
NB. peigen s/b 0.066,0.615,0.319 w/ cr of 0
pod=: >(1,(%9),(%5));(9,1,2);(5,(%2),1) NB. Prediction of dynamics
......................................................................
Thanks for your help,
Bill
- --
Bill Harris http://facilitatedsystems.com/weblog/
Facilitated Systems Everett, WA 98208 USA
http://facilitatedsystems.com/ phone: +1 425 337-5541
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: For more information, see http://www.gnupg.org
iD8DBQFEB5NG3J3HaQTDvd8RAlz1AJ9ZqXLjpIKywNiVWHJQiJ4UmIhh1QCaAksP
ssRGg+So11O9X371Buto/wY=
=rQqG
-----END PGP SIGNATURE-----
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm