Re: [R-sig-phylo] Plotting uncertainty in continuous ASR

2017-02-28 Thread Liam J. Revell

Hi Kevin.

I was thinking the same thing & this is already in phytools on GitHub: 
http://blog.phytools.org/2017/02/function-to-add-error-bars-to-contmap.html. 
Thanks for the suggestion.


All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/28/2017 4:30 AM, Arbuckle, Kevin wrote:

Hi Liam,

Absolutely fantastic, I can see this being useful on multiple occasions, 
particularly as it takes another step towards being more explicit about our 
uncertainty in ASRs for continuous traits (especially when traitgrams are not 
ideal for whatever reason). If you get time I would suggest turning that code 
into a function to add to phytools as it might be broadly useful for many 
researchers, but for my own purposes the code you have added to the blog is 
perfectly fine.

Best wishes,

Kev


From: Liam J. Revell [liam.rev...@umb.edu]
Sent: 27 February 2017 21:57
To: Arbuckle, Kevin; R phylo list
Subject: Re: [R-sig-phylo] Plotting uncertainty in continuous ASR

Hi Kevin.

I now show one way to do this here:
http://blog.phytools.org/2017/02/more-on-adding-error-bars-to-contmap.html.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/27/2017 2:32 PM, Arbuckle, Kevin wrote:

Hi Liam,

Thank for that, definitely much quicker than I could have figured it out. The 
only other thing I'd do would be have the length varying to reflect the range 
of the estimates, giving an immediate visual display of both the range of 
variation and the actual values encompassed, but that's something that can be 
tailored relatively easily from that code so thanks again.

Kev


From: Liam J. Revell [liam.rev...@umb.edu]
Sent: 27 February 2017 19:13
To: Arbuckle, Kevin; r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] Plotting uncertainty in continuous ASR

Hi Kevin.

This is not automatic - but it is indeed fairly easy to do using
phytools. To be honest, I thought this would look terrible - but it
actually looks much better than I expected, at least for a relatively
small tree. I have posted a demo to my blog here:
http://blog.phytools.org/2017/02/adding-colorful-error-bars-to-internal.html.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/27/2017 11:16 AM, Arbuckle, Kevin wrote:

Hi all,

I was wondering about plotting the output of an ancestral state 
'reconstruction' of a continuous trait while incorporating at least some of the 
uncertainty around the estimates.

One approach I thought of was to map the ASR onto a tree in a standard way, 
then at each node have essentially a mini-legend that is of a length reflecting 
the width of the confidence interval of the estimate at that node, and is 
coloured on the same colour-scale as the overall tree legend. For instance, if 
the colour scheme for the tree goes from blue through yellow to red as the 
value increases, then a node with a relatively precise and high estimate will 
have a short bar only ranging through different shades of red, whereas a highly 
uncertain low estimate will have a wider bar coloured from (say) dark blue to 
orange/light red. I hope that description makes sense.

I was wondering if anyone is aware of a function that already implements such an 
approach, otherwise I'll try to put one together myself. I am aware of phytool's 
fancyTree(type="phenogram95") as a way of incorporating uncertainty into a 
plotted ASR for continuous traits. However, this often results in difficulty in 
distinguishing different nodes where estimates are similar and also does not lend itself 
easily to, for instance, plotting pie charts representing discrete trait ASRs onto a tree 
mapped with a continuous trait. Hence I can imagine a more general approach as above but 
don't want to duplicate effort if a function already exists (and also if others feel this 
is a useful idea it can be added to existing packages If I share it as above).

Best wishes,
Kev
___
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/







___
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] Plotting uncertainty in continuous ASR

2017-02-27 Thread Liam J. Revell

Hi Dave.

Yes. It is not perfect, but I have shown how to do this here: 
http://blog.phytools.org/2017/02/more-on-adding-error-bars-to-contmap.html.


All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/27/2017 2:45 PM, David Bapst wrote:

That's really cool, Liam. Would it also be possible for one to do
multiple such error bars per node, for plotting ASRs for multiple
traits?
-Dave

On Mon, Feb 27, 2017 at 12:13 PM, Liam J. Revell  wrote:

Hi Kevin.

This is not automatic - but it is indeed fairly easy to do using phytools.
To be honest, I thought this would look terrible - but it actually looks
much better than I expected, at least for a relatively small tree. I have
posted a demo to my blog here:
http://blog.phytools.org/2017/02/adding-colorful-error-bars-to-internal.html.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org


On 2/27/2017 11:16 AM, Arbuckle, Kevin wrote:


Hi all,

I was wondering about plotting the output of an ancestral state
'reconstruction' of a continuous trait while incorporating at least some of
the uncertainty around the estimates.

One approach I thought of was to map the ASR onto a tree in a standard
way, then at each node have essentially a mini-legend that is of a length
reflecting the width of the confidence interval of the estimate at that
node, and is coloured on the same colour-scale as the overall tree legend.
For instance, if the colour scheme for the tree goes from blue through
yellow to red as the value increases, then a node with a relatively precise
and high estimate will have a short bar only ranging through different
shades of red, whereas a highly uncertain low estimate will have a wider bar
coloured from (say) dark blue to orange/light red. I hope that description
makes sense.

I was wondering if anyone is aware of a function that already implements
such an approach, otherwise I'll try to put one together myself. I am aware
of phytool's fancyTree(type="phenogram95") as a way of incorporating
uncertainty into a plotted ASR for continuous traits. However, this often
results in difficulty in distinguishing different nodes where estimates are
similar and also does not lend itself easily to, for instance, plotting pie
charts representing discrete trait ASRs onto a tree mapped with a continuous
trait. Hence I can imagine a more general approach as above but don't want
to duplicate effort if a function already exists (and also if others feel
this is a useful idea it can be added to existing packages If I share it as
above).

Best wishes,
Kev
___
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/



___
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/






___
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] Plotting uncertainty in continuous ASR

2017-02-27 Thread Liam J. Revell

Hi Kevin.

I now show one way to do this here: 
http://blog.phytools.org/2017/02/more-on-adding-error-bars-to-contmap.html.


All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/27/2017 2:32 PM, Arbuckle, Kevin wrote:

Hi Liam,

Thank for that, definitely much quicker than I could have figured it out. The 
only other thing I'd do would be have the length varying to reflect the range 
of the estimates, giving an immediate visual display of both the range of 
variation and the actual values encompassed, but that's something that can be 
tailored relatively easily from that code so thanks again.

Kev


From: Liam J. Revell [liam.rev...@umb.edu]
Sent: 27 February 2017 19:13
To: Arbuckle, Kevin; r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] Plotting uncertainty in continuous ASR

Hi Kevin.

This is not automatic - but it is indeed fairly easy to do using
phytools. To be honest, I thought this would look terrible - but it
actually looks much better than I expected, at least for a relatively
small tree. I have posted a demo to my blog here:
http://blog.phytools.org/2017/02/adding-colorful-error-bars-to-internal.html.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 2/27/2017 11:16 AM, Arbuckle, Kevin wrote:

Hi all,

I was wondering about plotting the output of an ancestral state 
'reconstruction' of a continuous trait while incorporating at least some of the 
uncertainty around the estimates.

One approach I thought of was to map the ASR onto a tree in a standard way, 
then at each node have essentially a mini-legend that is of a length reflecting 
the width of the confidence interval of the estimate at that node, and is 
coloured on the same colour-scale as the overall tree legend. For instance, if 
the colour scheme for the tree goes from blue through yellow to red as the 
value increases, then a node with a relatively precise and high estimate will 
have a short bar only ranging through different shades of red, whereas a highly 
uncertain low estimate will have a wider bar coloured from (say) dark blue to 
orange/light red. I hope that description makes sense.

I was wondering if anyone is aware of a function that already implements such an 
approach, otherwise I'll try to put one together myself. I am aware of phytool's 
fancyTree(type="phenogram95") as a way of incorporating uncertainty into a 
plotted ASR for continuous traits. However, this often results in difficulty in 
distinguishing different nodes where estimates are similar and also does not lend itself 
easily to, for instance, plotting pie charts representing discrete trait ASRs onto a tree 
mapped with a continuous trait. Hence I can imagine a more general approach as above but 
don't want to duplicate effort if a function already exists (and also if others feel this 
is a useful idea it can be added to existing packages If I share it as above).

Best wishes,
Kev
___
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/





___
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] Plotting uncertainty in continuous ASR

2017-02-27 Thread David Bapst
That's really cool, Liam. Would it also be possible for one to do
multiple such error bars per node, for plotting ASRs for multiple
traits?
-Dave

On Mon, Feb 27, 2017 at 12:13 PM, Liam J. Revell  wrote:
> Hi Kevin.
>
> This is not automatic - but it is indeed fairly easy to do using phytools.
> To be honest, I thought this would look terrible - but it actually looks
> much better than I expected, at least for a relatively small tree. I have
> posted a demo to my blog here:
> http://blog.phytools.org/2017/02/adding-colorful-error-bars-to-internal.html.
>
> All the best, Liam
>
> Liam J. Revell, Associate Professor of Biology
> University of Massachusetts Boston
> web: http://faculty.umb.edu/liam.revell/
> email: liam.rev...@umb.edu
> blog: http://blog.phytools.org
>
>
> On 2/27/2017 11:16 AM, Arbuckle, Kevin wrote:
>>
>> Hi all,
>>
>> I was wondering about plotting the output of an ancestral state
>> 'reconstruction' of a continuous trait while incorporating at least some of
>> the uncertainty around the estimates.
>>
>> One approach I thought of was to map the ASR onto a tree in a standard
>> way, then at each node have essentially a mini-legend that is of a length
>> reflecting the width of the confidence interval of the estimate at that
>> node, and is coloured on the same colour-scale as the overall tree legend.
>> For instance, if the colour scheme for the tree goes from blue through
>> yellow to red as the value increases, then a node with a relatively precise
>> and high estimate will have a short bar only ranging through different
>> shades of red, whereas a highly uncertain low estimate will have a wider bar
>> coloured from (say) dark blue to orange/light red. I hope that description
>> makes sense.
>>
>> I was wondering if anyone is aware of a function that already implements
>> such an approach, otherwise I'll try to put one together myself. I am aware
>> of phytool's fancyTree(type="phenogram95") as a way of incorporating
>> uncertainty into a plotted ASR for continuous traits. However, this often
>> results in difficulty in distinguishing different nodes where estimates are
>> similar and also does not lend itself easily to, for instance, plotting pie
>> charts representing discrete trait ASRs onto a tree mapped with a continuous
>> trait. Hence I can imagine a more general approach as above but don't want
>> to duplicate effort if a function already exists (and also if others feel
>> this is a useful idea it can be added to existing packages If I share it as
>> above).
>>
>> Best wishes,
>> Kev
>> ___
>> 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/
>>
>
> ___
> 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/



-- 
David W. Bapst, PhD
Adjunct Asst. Professor, Geology and Geol. Eng.
South Dakota School of Mines and Technology
501 E. St. Joseph
Rapid City, SD 57701

http://webpages.sdsmt.edu/~dbapst/
http://cran.r-project.org/web/packages/paleotree/index.html

___
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/