Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
likelihood per position/partition (Read 2752 times)
gustavo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
likelihood per position/partition
Aug 12th, 2004 at 3:23pm
 
How can I print the likelihood for each position of the alignment or for each partition?
Thanks very much in advance,


gustavo
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: likelihood per position/partition
Reply #1 - Aug 12th, 2004 at 5:13pm
 
Dear Gustavo,

The basic idea is to use a 'ConstructCategoryMatrix' command to tabulate site-by-site likelihood. This gets a little trickier is there are category (rate variation variables) involved, because the command outputs a vector of marginals for each site.

Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login

points to an example file (it's self-contained NEXUS) - look at the source of the example in the 'HYPHY' block to see how this works. Just open this a a regular batch file to execute the example.

In the GUI version (Mac and Windows), you can use 'Likelihood->Category Processor' menu from the parameter table window (which you can get to by opening the Object Inspector, finding the tree in the current analysis, opening its window and they choosing 'Tree->Show Parameters in Table' menu) to display a table with site-by-site likelihoods.

Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: likelihood per position/partition
Reply #2 - May 3rd, 2006 at 1:19pm
 
In case there are rate categories...

Assume for a second that you have a single category variable 'c' with D classes. If you call
ConstructCategoryMatrix on a likelihood function with 'c' in the model and N sites, you'll get an DxN matrix, where the entry in row i and column j tells you the likelihood of site j, given that 'c' takes value from its i-th class.

To compute the likelihood of a site then is simply a matter of computing expected values. You can do this as follows (replace variables as appropriate).

Code:
/* this needs HyPhy from 2006 for row indexing tricks */

GetInformation (catInfo, c);
ConstructCategoryMatrix (cmx, lf, COMPLETE);
/* extract the second row from catInfo - the weights for each class */
weights = catInfo[1][-1];
/* compute the expectations; these will be likelihoods; NOT log-likelihoods */
lkBySite = weights *cmx;
/* compute log-L */
logLBySite = Log (lkBySite);

 

Back to top
« Last Edit: May 4th, 2006 at 11:59am by Sergei »  

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged