MATLAB Answers


Can you help me with a logistic regression?

Asked by Mario Trevino on 9 May 2013

I need to solve the following system:

log(pR,i/pL,i)=SIGMA{ alpha_j [(rR,i-j)-(rL,i-j)]}+SIGMA{ beta_j [(cR,i-j)-(cL,i-j)]}+gamma

rR, rL, cR, cL: are known binary vectors (0,1) that describe the state of a system at different discrete times i=1,2,3,.... 'r' stands for reward, 'c' for choice, 'R' for right and 'L' for left (i.e. this is derived from a choice task with 2 options, L or R).

Note how the components for each summation are weighting the relative influence of past events as j increases.

PROBLEM 1: Im still uncertain on how to estimate the log odds (left portion of the equation). pR,i is the probability that cR,i==1.... and pL,i=1-pR,i. Likewise cL,i=1-cR,i.

PROBLEM 2: get alpha_j (function of j), beta_j (function of j), and gamma.


1 Answer

Answer by Tom Lane
on 10 May 2013

I don't understand your notation, in particular log(pR,i/pL,i). I guess you tried to explain that in PROBLEM 1, but I still don't understand what you intend to use as the response (or output or y) in this problem.

The Statistics Toolbox has a glmfit function (also for fitting binary logistic regression. That can cope with estimating odds even when the inputs are all 0 or 1. But I suspect from the fact that I don't follow your notation that this will not be adequate.

Can you explain any further, or point to a reference?


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!