HyPhy message board
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl
HYPHY Package >> HyPhy feedback >> ConstructCategoryMatrix
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?num=1158151583

Message started by konrad on Sep 13th, 2006 at 5:46am

Title: ConstructCategoryMatrix
Post by konrad on Sep 13th, 2006 at 5:46am
Dear Sergei,

How does the ConstructCategoryMatrix command work when the likelihood function uses more than one category variable? This is not clear from the documentation.

regards,
Konrad

Title: Re: ConstructCategoryMatrix
Post by Sergei on Sep 13th, 2006 at 8:07am
Dear Konrad,

If you have N category variables with C_1, ... C_N rate classes each, ConstructCategoryMatrix will generate a matrix with C_1 x C_2 ... x C_N rows and a column for each site. You can index into the column as you would into a normal multi-dimensional array in C, but using explicit indices. For example, for two category variables, to get the value for class i in variable 1 and class j in variable 2, you would use the index i*C_2 + j (assuming i and j are 0-based). For 3 variables:
i*C_2*C_3 + j*C_3 + k etc.

To determine the order for the category variables for indexing, you can call the function GetInformation (order_ID, lf_ID), and have the names of category variables stored in the matrix referred to by order_ID.

Cheers,
Sergei

HyPhy message board » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.