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     mean        sd 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.937473        NA 1
86 Batar_ciner_cin_f_crow 4.393245        NA 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     mean        sd 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.937473        NA 1 1.1493008
86 Batar_ciner_cin_f_crow 4.393245        NA 1 1.1493008






*--
*
*Rafael Sobral Marcondes*

PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
Museum of Natural Science <http://sites01.lsu.edu/wp/mns/>
Louisiana State University
119 Foster Hall
Baton Rouge, LA 70803, USA

Twitter: @rafmarcondes <https://twitter.com/rafmarcondes>


On Wed, Aug 17, 2016 at 8:59 AM, Rafael S. Marcondes
<raf.marcon...@gmail.com <mailto:raf.marcon...@gmail.com>> 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 <http://sites01.lsu.edu/wp/mns/>
    Louisiana State University
    119 Foster Hall
    Baton Rouge, LA 70803, USA

    Twitter: @rafmarcondes <https://twitter.com/rafmarcondes>


    On Tue, Aug 16, 2016 at 8:26 PM, Liam J. Revell <liam.rev...@umb.edu
    <mailto:liam.rev...@umb.edu>> 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
        <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/
        <http://faculty.umb.edu/liam.revell/>
        email: liam.rev...@umb.edu <mailto: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 <http://sites01.lsu.edu/wp/mns/
            <http://sites01.lsu.edu/wp/mns/>>
            Louisiana State University
            119 Foster Hall
            Baton Rouge, LA 70803, USA

            Twitter: @rafmarcondes <https://twitter.com/rafmarcondes
            <https://twitter.com/rafmarcondes>>

                    [[alternative HTML version deleted]]

            _______________________________________________
            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
            <https://stat.ethz.ch/mailman/listinfo/r-sig-phylo>
            Searchable archive at
            http://www.mail-archive.com/r-sig-phylo@r-project.org/
            <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/

Reply via email to