Re: [R-sig-phylo] Transition matrix for ace in ape

2014-05-23 Thread Rosemary McCloskey

Thanks! I didn't see an edit button, which is why I asked, but I figured out 
that you have to be a user to edit the wiki and made the change.

On 14-05-23 01:48 PM, Sam Price wrote:

Hi Rosemary,

You are correct the wiki has a typo, as it is a wiki so you should be able to 
correct yourself!

Sam


---
Samantha Price, Ph.D.
Dept. Evolution  Ecology
1 Shields Ave,
UC Davis
Davis, CA 95616
USA
Tel: +1 530-752-4720
Website: www.evovert.com http://www.evovert.com
---

On May 23, 2014, at 9:34 AM, Rosemary McCloskey rmcclosk.m...@gmail.com 
mailto:rmcclosk.m...@gmail.com wrote:


Hello,

I'm trying to do ancestral reconstruction of a discrete character state using 
ace. I'm referencing the Ancestral State Reconstruction HowTo on the R phylo 
wiki (http://www.r-phylo.org/wiki/HowTo/Ancestral_State_Reconstruction). It 
says how to use a custom model with ace:

What if you want to use a transition model that isn't hardwired into ace? You can 
do so by defining a custom transition matrix. For example, let's create a custom 
four-parameter matrix for a three state character, in which the the probability of 
transitioning from state 1 to 2 equals the probability of state 2 to 1 (parameter 1), the 
probability of transitioning from 1 to 3 equals the probability of transitioning from 
state 3 to 1 (parameter 2), but the probability of transitioning from state 2 to 3 
(parameter 3) does not necessarily equal the probability of transitioning from state 3 to 
2 (parameter 4).

Right below, on the page, it shows this matrix:

[,1] [,2] [,3]
[1,] 0 1 2
[2,] 1 0 4
[3,] 2 3 0

Isn't this the transpose of how model matrices normally work? I would expect the 
probability of transitioning from state 2 to 3 (parameter 3) to be in position 
[2,3], but it's in position [3,2] here. I realize that it doesn't make a difference in 
this case, but in my case I'm trying to define a non-reversible model so it does matter. 
So, sorry if this is a dumb question, but I just want to make sure: when passing a custom 
rate matrix to ace, does the transition from state i to state j go in position [i,j] of 
the matrix, or in position [j,i]? If this is just a typo in the wiki, who do I contact 
about correcting it?

Thanks!

Rosemary

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org 
mailto:R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/




___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Transition matrix for ace in ape

2014-05-23 Thread Hilmar Lapp
Great, Rosemary! If you encounter a problem with editing something on the
wiki, do let me know.

  -hilmar


On Fri, May 23, 2014 at 5:29 PM, Rosemary McCloskey rmcclosk.m...@gmail.com
 wrote:

 Thanks! I didn't see an edit button, which is why I asked, but I figured
 out that you have to be a user to edit the wiki and made the change.

 On 14-05-23 01:48 PM, Sam Price wrote:

 Hi Rosemary,

 You are correct the wiki has a typo, as it is a wiki so you should be
 able to correct yourself!

 Sam


 ---
 Samantha Price, Ph.D.
 Dept. Evolution  Ecology
 1 Shields Ave,
 UC Davis
 Davis, CA 95616
 USA
 Tel: +1 530-752-4720
 Website: www.evovert.com http://www.evovert.com
 ---


 On May 23, 2014, at 9:34 AM, Rosemary McCloskey 
 rmcclosk.m...@gmail.commailto:
 rmcclosk.m...@gmail.com wrote:

  Hello,

 I'm trying to do ancestral reconstruction of a discrete character state
 using ace. I'm referencing the Ancestral State Reconstruction HowTo on the
 R phylo wiki (http://www.r-phylo.org/wiki/HowTo/Ancestral_State_
 Reconstruction). It says how to use a custom model with ace:

 What if you want to use a transition model that isn't hardwired into
 ace? You can do so by defining a custom transition matrix. For example,
 let's create a custom four-parameter matrix for a three state character, in
 which the the probability of transitioning from state 1 to 2 equals the
 probability of state 2 to 1 (parameter 1), the probability of transitioning
 from 1 to 3 equals the probability of transitioning from state 3 to 1
 (parameter 2), but the probability of transitioning from state 2 to 3
 (parameter 3) does not necessarily equal the probability of transitioning
 from state 3 to 2 (parameter 4).

 Right below, on the page, it shows this matrix:

 [,1] [,2] [,3]
 [1,] 0 1 2
 [2,] 1 0 4
 [3,] 2 3 0

 Isn't this the transpose of how model matrices normally work? I would
 expect the probability of transitioning from state 2 to 3 (parameter 3)
 to be in position [2,3], but it's in position [3,2] here. I realize that it
 doesn't make a difference in this case, but in my case I'm trying to define
 a non-reversible model so it does matter. So, sorry if this is a dumb
 question, but I just want to make sure: when passing a custom rate matrix
 to ace, does the transition from state i to state j go in position [i,j] of
 the matrix, or in position [j,i]? If this is just a typo in the wiki, who
 do I contact about correcting it?

 Thanks!

 Rosemary

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org mailto:
 R-sig-phylo@r-project.org

 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-
 sig-ph...@r-project.org/



 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-
 sig-ph...@r-project.org/




-- 
Hilmar Lapp -:- informatics.nescent.org/wiki -:- lappland.io

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/