I'm interested in testing whether the variances of the proportions are
different between the two groups. If set the response to be the proportion
rather than the variance then I'm not sure how it answers my question.

About my data - each subject is seen between 15-30 times (i.e. binomial
distributions) from 3 different environments. That makes 45-90 replicates
per subject. In my table there's a column that lists the number of trials
in each replicate (number.trails) and another column that lists the number
of successes in each of the corresponding replicates (number.successes). So
both these columns are comma separated lists.

Paul, if you have a model in mind can you please share it with me even in
SAS syntax?

Thanks a lot,
Nimrod


On Wed, Mar 26, 2014 at 5:12 PM, Thompson,Paul <
Paul.Thompson@sanfordhealth.org> wrote:

>  That doesn't seem sensible to me. You can't use the same parameter as a
> independent and dependent variable. With a binomial RV, you model the
> proportion. You can't break the mean and variance into separate sections.
>
>
>
> 1)      You ask about linking subjects using ID as a RE? Absolutely
> needed.
>
> 2)      You cannot use  a Gaussian RV assumption. You have a binomial RV.
> You must use a generalized linear model with a binomial link.
>
> 3)      I don't see the problem with having different numbers of trials.
> You are modeling with several levels of complexity the likelihood of k
> successes out of n trials. In many cases, this involves the same subject.
> If I read correctly, each subject is seen 3 times in 3 environments, for a
> total of 9 per subject. That's fine. You need a replicate and environment
> factor (which I see in the data) and
>
>
>
> I cannot figure out why the counts are given as 3 things. It should be 2
> (k success, n tries). What's the third thing?
>
>
>
> I am primarily a SAS user. So, I'm gonna be of little help with R syntax.
> The model is the same in both toolsets, however.
>
>
>
> *From:* nimrod.rubinstein [mailto:nimrod.rubinstein@gmail.com]
> *Sent:* Wednesday, March 26, 2014 3:20 PM
> *To:* Thompson,Paul
> *Cc:* r-sig-mixed-models
> *Subject:* Re: [R-sig-ME] A mixed effects model for variances of binomial
> probability as a response
>
>
>
> Thanks for the note.
>
>
>
> I am aware of that and that is why I thought of using the mean as fixed
> effect. What would you suggest?
>
>
>
> Thanks,
>
> Nimrod
>
>
>
> On Wed, Mar 26, 2014 at 2:52 PM, Thompson,Paul <
> Paul.Thompson@sanfordhealth.org> wrote:
>
> One note before anyone gets into the R syntax:
>
> You wish to examine the variances. In binomial data, the variance is a
> simple function of the mean (the proportion). Thus, you cannot separate
> them into "models about variances" and "models about means". There is only
> one parameter.
>
>
> -----Original Message-----
> From: r-sig-mixed-models-bounces@r-project.org [mailto:
> r-sig-mixed-models-bounces@r-project.org] On Behalf Of nimrod.rubinstein
> Sent: Wednesday, March 26, 2014 11:16 AM
> To: r-sig-mixed-models@r-project.org
> Subject: [R-sig-ME] A mixed effects model for variances of binomial
> probability as a response
>
> Hi all,
>
> I have the following data:
>
> 50 subjects that belong to 2 groups (25 in each group). For each subject I
> have replicated measurements (in the range of 15-30 replicates per subject)
> of the number of trails as well as the number successes out of these
> trails. Each single trial in each single replicate for each subject is
> assumed to be a Bernoulli experiment, therefore the number of successes in
> each replicate is assumed to be a binomially distributed random variable.
> To complicate things even more, for each subject from each group I have not
> 1 but 3 series of these replicated measurements, from 3 different
> environments (the 3 environments are the same for all subjects).
>
> A few example lines of how my data looks like:
> subject group environment     number.trails  number.successes
>
>     S1    G1          E1 10100,13209,17621  8500,11622,14684
>
>     S1    G1          E2 13322,12225,10024  10351,10222,7951
>
>     S1    G1          E3  9812,13500,13214  7245,10622,10684
>
>     .
>
>     .
>
>     .
>
>     S50    G2          E1 60547,75345,68412 12014,13214,15244
>
>     S50    G2          E2 50897,62541,61247 10141,13251,30645
>
>     S50    G2          E3 59214,84264,74156 17245,16425,11123
>
>
> Where the comma separated number of successes correspond to the comma
> separated number of trials in each replicate.
>
> I want to test whether the variances of the success probabilities of
> subjects from group G1 are significantly smaller than the variances of the
> success probabilities of subjects from group G2.
>
> In other words, for each subject in each replicate a success probability
> can be estimated from the observed data. Then the variance of those success
> probabilities over all replicates from a specific environment can be
> estimated. I would like to know whether these variances are smaller in
> subjects from G1 vs. subjects from G2.
>
> The issues are:
>
>      1. The variance of a success probability depends on the success
>
>    probability itself (natural to binomially distributed data). I need to
>    account for this effect.
>
>    2. The number of trails (although at least in the hundreds for all
>
>    subjects) varies several orders of magnitude among subjects. That by
> itself
>    affects the accuracy of estimating the success probability, but in
>    addition, I cannot rule out an inherent dependency between the number of
>    observed trials and the success probability (there is no control over
> the
>    number of trials in the experiment - it is observed). In other words,
>    having a lower number of trails by itself may affect the success
>    probability.
>
>
> I though a simple way to test my hypothesis is to compute the success
> probability in each replicate as number.successes/number.trails, and then
> the sample mean and sample variance of these success probabilities over all
> replicates, as well as the mean number of trials over all replicates (added
> to my data as sample.mean, sample.var and mean.trials fields). Then I can
> use the lmer function in the lme4 package this way:
>
> null.model = lmer(sample.var ~ sample.mean + mean.trials +
> (1|environment), my.data, REML = F) alt.model = lmer(sample.var ~
> sample.mean + mean.trials + group + (1|environment), my.data, REML = F)
>
> So fixed effects are: sample.mean, mean.trials and group, and random
> effects is environment since the three environments in my data are simply a
> random sample from many other possible environments.
>
> To test whether group has a significant effect I'll do:
>
> anova(null.model, alt.model).
>
> My concerns are:
>
>     1. Should I add subject as a random effect? My intuition is not to
> since
>
>    subjects are unique to groups, which is the effect I'm after. However,
> I do
>    want to account for the fact that sample variances of the same subject
> from
>    the three different environments are correlated.
>
>    2. The response - sample variances, cannot be assumed to follow a normal
>
>    distribution (they only take positive values to begin with and as far
> as I
>    know (n-1)*sample.variance/population.variance ~ chi.square with df =
> n-1)
>    and therefore the assumptions of a linear mixed effects model do not
>    strictly hold. Is there a generalized linear model that would be
>    appropriate for this?
>
> Thanks a lot,
> nimrod
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> -----------------------------------------------------------------------
> Confidentiality Notice: This e-mail message, including any attachments,
> is for the sole use of the intended recipient(s) and may contain
> privileged and confidential information.  Any unauthorized review, use,
> disclosure or distribution is prohibited.  If you are not the intended
> recipient, please contact the sender by reply e-mail and destroy
> all copies of the original message.
>
>
>
>
> -----------------------------------------------------------------------
> Confidentiality Notice: This e-mail message, including any attachments,
> is for the sole use of the intended recipient(s) and may contain
> privileged and confidential information.  Any unauthorized review, use,
> disclosure or distribution is prohibited.  If you are not the intended
> recipient, please contact the sender by reply e-mail and destroy
> all copies of the original message.
>
>
>
>

	[[alternative HTML version deleted]]

