Re: [R-sig-phylo] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-19 Thread Liam J. Revell

Hi Rafael.

> Also, I realized that this has the effect of making the mserr of
> species with sample size of 1 equal to the pooled standard deviation.

Yes. This makes sense because our uncertainty about that observation of 
the mean should be exactly equal to the population dispersion around the 
true mean.


> Do you mind having a quick look at the piece of code below to see if
> I'm interpreting your suggestion correctly?

I just posted a function for the pooled variance on my blog: 
http://blog.phytools.org/2016/08/simple-function-to-compute-pooled.html. 
Maybe you can use this to double-check your code. You should be able to 
just take the value from this function, and divide it's square-root by a 
vector consisting of the square-roots of the sample sizes of each 
species to get your (pooled) species-specific standard errors.


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 8/18/2016 4:34 PM, Rafael S. Marcondes wrote:

Hi again Liam,

Do you mind having a quick look at the piece of code below to see if I'm
interpreting your suggestion correctly?

Also, I realized that this has the effect of making the mserr of species
with sample size of 1 equal to the pooled standard deviation. Is this
what you had in mind?

Thank you so much again! That was a really helpful suggestion.

I have attached my dat.R file.


load('dat.R')
head(dat)

 name meansd n
4  Aklet_goeld_xxx_f_crow 5.350051 1.8719113 4
21 Aklet_melan_xxx_f_crow 2.599925 0.7038916 4
38 Ampel_grise_xxx_f_crow 8.818584 2.2707127 4
54 Apros_disju_xxx_f_crow 5.400079 0.7584150 2
70 Batar_ciner_arg_f_crow 6.937473NA 1
86 Batar_ciner_cin_f_crow 4.393245NA 1


psd=weighted.mean(x=dat[,'sd'], w=dat[,'n'], na.rm=TRUE)

#pooled standard deviation (wheighted avg of SDs for each tip)


pv=psd^2

#pooled variance (square of psd)


dat[,5]=sqrt(pv)/sqrt(dat[,'n'])
colnames(dat)=c('name', 'mean', 'sd', 'n', 'mserr')
head(dat)


 name meansd n mserr
4  Aklet_goeld_xxx_f_crow 5.350051 1.8719113 4 0.5746504
21 Aklet_melan_xxx_f_crow 2.599925 0.7038916 4 0.5746504
38 Ampel_grise_xxx_f_crow 8.818584 2.2707127 4 0.5746504
54 Apros_disju_xxx_f_crow 5.400079 0.7584150 2 0.8126784
70 Batar_ciner_arg_f_crow 6.937473NA 1 1.1493008
86 Batar_ciner_cin_f_crow 4.393245NA 1 1.1493008






*--
*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 


On Wed, Aug 17, 2016 at 8:59 AM, Rafael S. Marcondes
> wrote:

Hi Liam,

Great, thank you! I'll definitely try that. Do you know of any
references describing that approach in detail, or using it in practice?

Thank you,

*--
*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 


On Tue, Aug 16, 2016 at 8:26 PM, Liam J. Revell > wrote:

Hi Rafael.

What I would recommend in the case where you have relatively
small samples per species is to compute a pooled within-species
variance (https://en.wikipedia.org/wiki/Pooled_variance
). This is
effectively equivalent to assuming that the within-species
variances are relatively homogeneous across species - which is
probably pretty reasonable, particularly if your data are on a
log-scale. You would then compute the standard error of each
species mean as the square-root of this value divided by the
square-root of each species-specific sample size. These values
would then be your input for OUwie or other model-fitting
methods that take species mean standard errors.

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 8/16/2016 4:34 PM, Rafael S. Marcondes wrote:

Hi all,

I’m using OUwie to fit multi-optima OU models and I have a
question about
incorporating measurement error into my analyses.

I’m running my models with known measurement error
 

Re: [R-sig-phylo] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-17 Thread Rafael S. Marcondes
Hi Liam,

Great, thank you! I'll definitely try that. Do you know of any references
describing that approach in detail, or using it in practice?

Thank you,


*--*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 


On Tue, Aug 16, 2016 at 8:26 PM, Liam J. Revell  wrote:

> Hi Rafael.
>
> What I would recommend in the case where you have relatively small samples
> per species is to compute a pooled within-species variance (
> https://en.wikipedia.org/wiki/Pooled_variance). This is effectively
> equivalent to assuming that the within-species variances are relatively
> homogeneous across species - which is probably pretty reasonable,
> particularly if your data are on a log-scale. You would then compute the
> standard error of each species mean as the square-root of this value
> divided by the square-root of each species-specific sample size. These
> values would then be your input for OUwie or other model-fitting methods
> that take species mean standard errors.
>
> 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 8/16/2016 4:34 PM, Rafael S. Marcondes wrote:
>
>> Hi all,
>>
>> I’m using OUwie to fit multi-optima OU models and I have a question about
>> incorporating measurement error into my analyses.
>>
>> I’m running my models with known measurement error (mserr=‘known’) and
>> using the standard error (std.error()) as an estimate of it, as
>> recommended
>> by Ives et al (2007). However, for some (a minority) of my tips, I was
>> only
>> able to measure 1 specimen, so I have no standard error for them. So I’m
>> not sure about how to deal with those. At first I thought about just
>> setting their measurement error as 0, but then I figured that would
>> introduce false confidence. So what I’m doing now is I’m setting
>> measurement error for those tips as the mean of the errors of all the tips
>> for which I did measure more than one specimen. I got that idea also from
>> Ives et al when they mention averaging the error across species (jn the
>> third-to-last paragraph), but that was in a different context. I can’t
>> find
>> any references that report dealing with the same problem, even though I
>> assume it must not be an uncommon one. So I’m wondering if mine is really
>> the best way to do it and, or if anyone has alternative suggestions?
>>
>> i hope I’ve made my problem clear, and thanks in advance for any
>> suggestions.
>>
>>
>> *--*
>> *Rafael Sobral Marcondes*
>>
>> PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
>> Museum of Natural Science 
>> Louisiana State University
>> 119 Foster Hall
>> Baton Rouge, LA 70803, USA
>>
>> Twitter: @rafmarcondes 
>>
>> [[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-ph...@r-project.org/
>>
>>

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

Re: [R-sig-phylo] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-17 Thread Brian O'Meara
Another possibility is to do a regression to predict variance for species
with a single observation. Or even do a phylogenetic regression so species
nearer the ones with missing data matter more.

But all this stuff is minor tweaks: it's great you're incorporating
measurement error at all, and I hope your results are robust to any of
these suggestions for tweaks.

Best,
Brian

___
Brian O'Meara, http://www.brianomeara.info, especially Calendar
, CV
, and Feedback


Associate Professor, Dept. of Ecology & Evolutionary Biology, UT Knoxville
Associate Head, Dept. of Ecology & Evolutionary Biology, UT Knoxville
Associate Director for Postdoctoral Activities, National Institute for
Mathematical & Biological Synthesis  (NIMBioS)
Communication Director, Society of Systematic Biologists

On Tue, Aug 16, 2016 at 11:53 PM, Liam J. Revell 
wrote:

> Hi Santiago.
>
> This is identical to my suggestion, except that the pooled variance is a
> weighted mean in which weights (for better or worse) are proportional to
> the sample size of each species. If the variances are indeed homogeneous,
> this should be preferred because it gives greater weight to species whose
> variance we should know well. If not, then it risks giving high weight to a
> species with a well-estimated, but peculiarly high or low variance.
> Computing the straight mean, as you suggest, comes with exactly the
> opposite set of shortcomings since species with relatively small sample
> sizes may have very poorly estimated variances.
>
> 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 8/16/2016 10:46 PM, Santiago Claramunt wrote:
>
>> Hi Rafael,
>>
>> Your method would underestimate the error associated with values derived
>> from single specimens because those values would have the highest errors,
>> not average errors.
>> What I have done in such cases is to estimate an average standard
>> deviation across species and use that average standard deviation as the
>> standard error of the species with single specimens.
>> I don't know of a formal description of this solution but it is mentioned
>> in one of my papers: http://rspb.royalsocietypublis
>> hing.org/content/279/1733/1567
>>
>> Best,
>>
>> Santiago
>>
>> Research Associate
>> Department of Ornithology
>> American Museum of Natural History
>> https://sites.google.com/site/sclaramuntuy/
>>
>>
>> On Aug 16, 2016, at 4:34 PM, Rafael S. Marcondes 
>>> wrote:
>>>
>>> Hi all,
>>>
>>> I’m using OUwie to fit multi-optima OU models and I have a question about
>>> incorporating measurement error into my analyses.
>>>
>>> I’m running my models with known measurement error (mserr=‘known’) and
>>> using the standard error (std.error()) as an estimate of it, as
>>> recommended
>>> by Ives et al (2007). However, for some (a minority) of my tips, I was
>>> only
>>> able to measure 1 specimen, so I have no standard error for them. So I’m
>>> not sure about how to deal with those. At first I thought about just
>>> setting their measurement error as 0, but then I figured that would
>>> introduce false confidence. So what I’m doing now is I’m setting
>>> measurement error for those tips as the mean of the errors of all the
>>> tips
>>> for which I did measure more than one specimen. I got that idea also from
>>> Ives et al when they mention averaging the error across species (jn the
>>> third-to-last paragraph), but that was in a different context. I can’t
>>> find
>>> any references that report dealing with the same problem, even though I
>>> assume it must not be an uncommon one. So I’m wondering if mine is really
>>> the best way to do it and, or if anyone has alternative suggestions?
>>>
>>> i hope I’ve made my problem clear, and thanks in advance for any
>>> suggestions.
>>>
>>>
>>> *--*
>>> *Rafael Sobral Marcondes*
>>>
>>> PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
>>> Museum of Natural Science 
>>> Louisiana State University
>>> 119 Foster Hall
>>> Baton Rouge, LA 70803, USA
>>>
>>> Twitter: @rafmarcondes 
>>>
>>> [[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-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 

Re: [R-sig-phylo] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-16 Thread Liam J. Revell

Hi Santiago.

This is identical to my suggestion, except that the pooled variance is a 
weighted mean in which weights (for better or worse) are proportional to 
the sample size of each species. If the variances are indeed 
homogeneous, this should be preferred because it gives greater weight to 
species whose variance we should know well. If not, then it risks giving 
high weight to a species with a well-estimated, but peculiarly high or 
low variance. Computing the straight mean, as you suggest, comes with 
exactly the opposite set of shortcomings since species with relatively 
small sample sizes may have very poorly estimated variances.


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 8/16/2016 10:46 PM, Santiago Claramunt wrote:

Hi Rafael,

Your method would underestimate the error associated with values derived from 
single specimens because those values would have the highest errors, not 
average errors.
What I have done in such cases is to estimate an average standard deviation 
across species and use that average standard deviation as the standard error of 
the species with single specimens.
I don't know of a formal description of this solution but it is mentioned in 
one of my papers: http://rspb.royalsocietypublishing.org/content/279/1733/1567

Best,

Santiago

Research Associate
Department of Ornithology
American Museum of Natural History
https://sites.google.com/site/sclaramuntuy/



On Aug 16, 2016, at 4:34 PM, Rafael S. Marcondes  
wrote:

Hi all,

I’m using OUwie to fit multi-optima OU models and I have a question about
incorporating measurement error into my analyses.

I’m running my models with known measurement error (mserr=‘known’) and
using the standard error (std.error()) as an estimate of it, as recommended
by Ives et al (2007). However, for some (a minority) of my tips, I was only
able to measure 1 specimen, so I have no standard error for them. So I’m
not sure about how to deal with those. At first I thought about just
setting their measurement error as 0, but then I figured that would
introduce false confidence. So what I’m doing now is I’m setting
measurement error for those tips as the mean of the errors of all the tips
for which I did measure more than one specimen. I got that idea also from
Ives et al when they mention averaging the error across species (jn the
third-to-last paragraph), but that was in a different context. I can’t find
any references that report dealing with the same problem, even though I
assume it must not be an uncommon one. So I’m wondering if mine is really
the best way to do it and, or if anyone has alternative suggestions?

i hope I’ve made my problem clear, and thanks in advance for any
suggestions.


*--*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 

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


___
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] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-16 Thread Santiago Claramunt
Hi Rafael,

Your method would underestimate the error associated with values derived from 
single specimens because those values would have the highest errors, not 
average errors.
What I have done in such cases is to estimate an average standard deviation 
across species and use that average standard deviation as the standard error of 
the species with single specimens.
I don't know of a formal description of this solution but it is mentioned in 
one of my papers: http://rspb.royalsocietypublishing.org/content/279/1733/1567

Best,

Santiago

Research Associate
Department of Ornithology
American Museum of Natural History
https://sites.google.com/site/sclaramuntuy/


> On Aug 16, 2016, at 4:34 PM, Rafael S. Marcondes  
> wrote:
> 
> Hi all,
> 
> I’m using OUwie to fit multi-optima OU models and I have a question about
> incorporating measurement error into my analyses.
> 
> I’m running my models with known measurement error (mserr=‘known’) and
> using the standard error (std.error()) as an estimate of it, as recommended
> by Ives et al (2007). However, for some (a minority) of my tips, I was only
> able to measure 1 specimen, so I have no standard error for them. So I’m
> not sure about how to deal with those. At first I thought about just
> setting their measurement error as 0, but then I figured that would
> introduce false confidence. So what I’m doing now is I’m setting
> measurement error for those tips as the mean of the errors of all the tips
> for which I did measure more than one specimen. I got that idea also from
> Ives et al when they mention averaging the error across species (jn the
> third-to-last paragraph), but that was in a different context. I can’t find
> any references that report dealing with the same problem, even though I
> assume it must not be an uncommon one. So I’m wondering if mine is really
> the best way to do it and, or if anyone has alternative suggestions?
> 
> i hope I’ve made my problem clear, and thanks in advance for any
> suggestions.
> 
> 
> *--*
> *Rafael Sobral Marcondes*
> 
> PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
> Museum of Natural Science 
> Louisiana State University
> 119 Foster Hall
> Baton Rouge, LA 70803, USA
> 
> Twitter: @rafmarcondes 
> 
>   [[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/

___
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] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-16 Thread Liam J. Revell

Hi Rafael.

What I would recommend in the case where you have relatively small 
samples per species is to compute a pooled within-species variance 
(https://en.wikipedia.org/wiki/Pooled_variance). This is effectively 
equivalent to assuming that the within-species variances are relatively 
homogeneous across species - which is probably pretty reasonable, 
particularly if your data are on a log-scale. You would then compute the 
standard error of each species mean as the square-root of this value 
divided by the square-root of each species-specific sample size. These 
values would then be your input for OUwie or other model-fitting methods 
that take species mean standard errors.


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 8/16/2016 4:34 PM, Rafael S. Marcondes wrote:

Hi all,

I’m using OUwie to fit multi-optima OU models and I have a question about
incorporating measurement error into my analyses.

I’m running my models with known measurement error (mserr=‘known’) and
using the standard error (std.error()) as an estimate of it, as recommended
by Ives et al (2007). However, for some (a minority) of my tips, I was only
able to measure 1 specimen, so I have no standard error for them. So I’m
not sure about how to deal with those. At first I thought about just
setting their measurement error as 0, but then I figured that would
introduce false confidence. So what I’m doing now is I’m setting
measurement error for those tips as the mean of the errors of all the tips
for which I did measure more than one specimen. I got that idea also from
Ives et al when they mention averaging the error across species (jn the
third-to-last paragraph), but that was in a different context. I can’t find
any references that report dealing with the same problem, even though I
assume it must not be an uncommon one. So I’m wondering if mine is really
the best way to do it and, or if anyone has alternative suggestions?

i hope I’ve made my problem clear, and thanks in advance for any
suggestions.


*--*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 

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



___
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] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-16 Thread Rafael S. Marcondes
Hi all,

I’m using OUwie to fit multi-optima OU models and I have a question about
incorporating measurement error into my analyses.

I’m running my models with known measurement error (mserr=‘known’) and
using the standard error (std.error()) as an estimate of it, as recommended
by Ives et al (2007). However, for some (a minority) of my tips, I was only
able to measure 1 specimen, so I have no standard error for them. So I’m
not sure about how to deal with those. At first I thought about just
setting their measurement error as 0, but then I figured that would
introduce false confidence. So what I’m doing now is I’m setting
measurement error for those tips as the mean of the errors of all the tips
for which I did measure more than one specimen. I got that idea also from
Ives et al when they mention averaging the error across species (jn the
third-to-last paragraph), but that was in a different context. I can’t find
any references that report dealing with the same problem, even though I
assume it must not be an uncommon one. So I’m wondering if mine is really
the best way to do it and, or if anyone has alternative suggestions?

i hope I’ve made my problem clear, and thanks in advance for any
suggestions.


*--*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science 
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes 

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