2
$\begingroup$

I have data extracted from a state machine. Each row of data looks like this:

label1,label2,label3,impedance,did_state_change

The column data types are described as follows:

label1,label2,label3: These are nominal (categorical) values
impedance: This is a ratio value (float number)
did_state_change: This is a categorical value (boolean)

What I'm trying to do is to come up with a model that will help to estimate the probability of a state change, given a 4-tuple of (label1,label2,label3,impedance).

I am not sure which statistical model to use and will appreciate some help in choosing the correct analysis/model.

$\endgroup$
5
$\begingroup$

First, is it appropriate to assume that the trials are independent of each other? Let's assume that.

Hopefully the predictors label, label2, label3 do not have too many categories. If a categorical variable has $n$ possible values, then the model will have to estimate $n-1$ different parameters. If each has relatively few categories, that is fine, but if there are a large number of categories you may want to think whether they can be grouped together in some way to make the analysis more intuitive.

You have said that impedance is a ratio value. It may turn out that you don't get the best fit using impedance as a linear coefficient because its true relationship to the fit is non-linear. You might try fitting one model with impedance and one with log(impedance), and see which one has a better fit overall.

Luckily, your response variable is binary-valued, and you want to estimate the probability of a state change. You should try a binomial logistic regression, so that you are estimating $ln\left(\frac{p}{1-p}\right)$ rather than $p$ directly (this is called "logit" function). If you used the glm package in R, you would input the model approximately like this:

fitted.model <- glm(did_state_change ~ impedance + label1 + label2 + label3, family = binomial(link="logit"), data = yourDataFrame)

If there is reason to believe that the variance will not be uniform across trials, you can choose quasibinomial as the family rather than binomial.

Consider looking at some example problems in a textbook on the topic, e.g. Gelman and Hill (2007)

Let's say that you are also interested in finding a cutoff point for impedence, above which the probability of a state change, for given values of label_i, exceeds a certain value $x$. When you fit a basic binary logistic regression, you will get parameters specifying an intercept $\alpha$ and $\beta_i$ (coefficients of the predictors). Supposing that we do a dumbed down model, where only impedence is used as a predictor (call it $I$), then the model will return parameters $\alpha$ and $\beta_1$ for an equation having the form:

$$ln\left(\frac{p}{1-p}\right) = \alpha + \beta_1I$$

If $\beta_1$ is positive, then $p$ will increase with increasing $I$. In that case, you can plug in your cutoff point, $x$, and solve for $I$, getting:

$$I(p=x) = \frac{1}{\beta_1}\left\{ln\left(\frac{x}{1-x}\right) - \alpha\right\}$$

You can simplify some of this by programming a little logit function in R:

logit <- function(x){log(x/(1-x))}

Then if you type in logit(x) it will return $ln\left(\frac{x}{1-x}\right)$.

$\endgroup$
  • $\begingroup$ Thanks for the detailed response. First of all, the assumption of independence of trials is a fair one. I think I will be using the logistic binomial regression as suggested - after a little bit more reading. On greater reflection of the problem, I think the categorical data (categorized from float values) are better left as float (ratio) values. Last but not the least, I would like to 'invert' the model (for lack of a better way of putting it), so that I can answer the question: beyond what level (i.e. value) of impedance can I expect a state change with a probability of x%? $\endgroup$ – Homunculus Reticulli Mar 24 '12 at 23:56
  • $\begingroup$ @HomunculusReticulli if you fit the model with impedance as a continuous variable it will return for you a monotonic function of the probability of state change as a function of impedance. You can then just solve the equation for x%, since it is monotonic that will be the cutoff point. $\endgroup$ – user9437 Mar 25 '12 at 0:23
  • $\begingroup$ That went a little over my head. Could you elaborate some more (perhaps with an R statement or two) to make it a little easier to understand what you mean?. Thanks $\endgroup$ – Homunculus Reticulli Mar 25 '12 at 0:36
  • $\begingroup$ @HomunculusReticulli see the addendum in the answer body. $\endgroup$ – user9437 Mar 25 '12 at 1:47
  • $\begingroup$ Thanks very much for the detailed response!. I should be able to carry on from this point onward. $\endgroup$ – Homunculus Reticulli Mar 25 '12 at 11:35
2
$\begingroup$

I would recommend a binomial regression model. It gives the probability of taking one of two values based on a matrix of explanatory variables. http://en.wikipedia.org/wiki/Binomial_regression The R command is glm(family=binomial)

Logit models remove much of the interpretation on the coefficients, because you start getting into relative utility theory. Very valuable in lots of applications, but not really when you're describing processes that don't involve valued behavior.

$\endgroup$
  • $\begingroup$ I don't understand your 2nd paragraph at all. Care to clarify/elaborate? $\endgroup$ – rolando2 Mar 24 '12 at 17:08
  • $\begingroup$ I apologize for not being perfectly clear. The point I wanted to make is simply that binary or multinomial logit models are typically not linear in their parameters. So the interpretation of the coefficients is not simply "an increase in $x$ leads to a $\beta$ increase in $y$," as you can usually say with linear regression. If this interpretation is important for your analysis, stay away from logit models. $\endgroup$ – gregmacfarlane Mar 24 '12 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.