Message Boards Message Boards

Get prediction intervals of parameters on GLM Binomial models?

Posted 5 years ago

Using Binomial data we need to determine predicational intervals on x at specific probabilities (Y). Enclosed is code that produces a visual representation of example fitted data but not the + and - 95% prediction values of x. The image of the plot (copy included) indicates the two points we need to determine.

Attachment

Attachments:
POSTED BY: Terry Acree
5 Replies

hello Bill

You hit the nail on the head I am having problems with language, as my parameter-variable faux-pax made clear. I have included a copy of the data I used to generate the plot. A glance will make it clear that it is a Binomial (n=12) data set and not Bernoulli. The column on the left is the predictor variable tested 12 times for each value of x and the column on the right is the response variable y. Or am I mistaken. { {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2.69897, 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {2., 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1.69897, 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {1., 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0.69897, 1.}, {0., 0.}, {0., 0.}, {0., 0.}, {0., 0.}, {0., 0.}, {0., 0.}, {0., 0.}, {0., 1.}, {0., 1.}, {0., 1.}, {0., 1.}, {0., 1.}, {-0.30103, 0.}, {-0.30103, 0.}, {-0.30103, 0.}, {-0.30103, 0.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-0.30103, 1.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1., 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 0.}, {-1.30103, 1.} }

POSTED BY: Terry Acree
Posted 5 years ago

I'm having a hard time understanding the seemingly inconsistent and non-standard GLM language you are using. Below I'm just attempting to state what I think you have in terms of more standard statistical language (or if you want, jargon).

If you use the command

GeneralizedLinearModelFit[p, x, x, ExponentialFamily -> "Binomial"]

you have a dataset named p with a single predictor variable x such that response variable y has a Bernoulli distribution (equivalent to a binomial distribution with a sample size of 1) with parameter $P$ (not to be confused with the name of your dataset) equal to

$$P=1-1/(1+e^{c0 +c_1 x})$$

or equivalently

$$\log(P/(1-P))=c_0+c_1 x$$

where $x$ is the relative concentration of odorant $A$ with $x=A/(A+B)$.

If you knew $c_0$ and $c_1$, then you could determine the value of $x$ that satisfies

$$P=1-1/(1+\exp{(c0+c_1 x}))$$

But you only have a sample of binomial results from a variety of relative concentrations. To obtain confidence intervals for the above value of $x$ when $P=0.5$ you would use the commands I gave earlier. (And, sorry, using $c_0$ sometimes displays as $c0$. Don't know why.)

You can probably find more concrete examples of what you want from searching for "LD50 confidence intervals".

POSTED BY: Jim Baldwin

I will try to express the question in a simpler way.

Starting with binomial odor responses to different concentrations of pairs of odorants we fit the data to a GLM model: y = GeneralizedLinearModelFit[p, x, x, ExponentialFamily -> "Binomial"]. The values of the model are the odor responses to the binomial choice A or B and y is expressed as A/( A+B). The arguments, a ratio of concentrations ([A]/[B]), is the independent variable. However we do not want to predict y from x but to determine x at a given value of y (0.5). If B is a blank X = x(at y = 0.50) is the threshold of A in the presence of B. We would like to determine a confidence interval (95%) in which X will fall. Does this mean that y is the independent variable (=0.5) and x is the dependent variable?

POSTED BY: Terry Acree

Thanks Jim

There is a 95% probability the means will be found in the "confidence interval" while 95% of the data will be found in the "prediction interval". The meaning of this using the code that generated the plot here in is not clear to me. What ever it is I need the values for x shown on the plot and of course I need to understand what they mean. The data comes from high speed puffs of odorant mixtures (70ms) in response to different odorant ratios [A]/[B], the x axis is the log( [A]/[B]). The response is binomial, 0 or 1, replicated 12 times for A and 12 times for be B but randomized. The y axis is the probability of detecting A in the presents of B at the concentration ratio x. If B is a blank, x at y=0.5 is a threshold. Our interest is in x at y=0.5 when B is a different odorant. Any help with this would be great.

Attachment

Attachments:
POSTED BY: Terry Acree
Posted 5 years ago

I think what you want are confidence intervals for $x$ given some probability $p$ (not prediction or predictional intervals - and I don't know what predictional intervals are).

Because the model you're fitting is

$$\log \left(\frac{\text{prob}}{1-\text{prob}}\right)=a+b x$$

you want confidence intervals for $x$

$$x = \frac{\log \left(\frac{\text{prob}}{1-\text{prob}}\right)-a}{b}$$

You can get the lower and upper limits for a 95% confidence interval for $x$ with the following:

prob = 0.5;
upper= tt /. Solve[prob == 1 - 1/(1 + Exp[parms.{1, tt} - 1.96 Sqrt[{1, tt}.cov.{1, tt}]]), tt]
lower= tt /. Solve[prob == 1 - 1/(1 + Exp[parms.{1, tt} + 1.96 Sqrt[{1, tt}.cov.{1, tt}]]), tt]
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract