Path: news.mathworks.com!not-for-mail
From: "Daniel " <dan.merfeld@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: glm with probit model
Date: Tue, 11 Nov 2008 13:13:01 +0000 (UTC)
Organization: Harvard University
Lines: 40
Message-ID: <gfc0ct$cnl$1@fred.mathworks.com>
References: <geapba$62l$1@fred.mathworks.com> <gecis6$hje$1@fred.mathworks.com> <gf6c79$87j$1@fred.mathworks.com> <gf9k8o$e3s$1@fred.mathworks.com> <gf9oam$jvi$1@fred.mathworks.com> <gface8$ka3$1@fred.mathworks.com>
Reply-To: "Daniel " <dan.merfeld@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1226409181 13045 172.30.248.38 (11 Nov 2008 13:13:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 11 Nov 2008 13:13:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 45502
Xref: news.mathworks.com comp.soft-sys.matlab:500193


Hi Peter , thanks for all of your help.  it seems that I am very close but I seem to missing something critical.  Following your suggestion, I defined the following functions:

myilink = @(eta) L + (1-2*L).*normcdf(min(max(eta,lowerBnd),upperBnd));
mylink = @(mu) norminv((mu-L)./(1-2*L));
mydlink = @(mu) 1 ./ ((1-2*L).*normpdf(norminv((mu-L)./(1-L))));

If I fit with the standard probit model:
b = glmfit(motion,y,'binomial','link','probit');
everything works fine, so I know that my input vectors and general approach are correct.

However, when I fit using the following call (as I believe you had suggested):
b = glmfit(motion,y,'binomial','link',{mylink mydlink myilink});
I get the following error message:

??? Input argument "L" is undefined.

Error in ==> direction_detect>@(mu,L)norminv((mu-L)./(1-2*L)) at 64
mylink = @(mu,L) norminv((mu-L)./(1-2*L));

Error in ==> glmfit at 277
eta = linkFun(mu);

Error in ==> direction_detect at 77
    b = glmfit(motion,y,'binomial','link',{mylink mydlink myilink});

First, I should probably let you know that L is defined and is a scalar.  It is defined via the following three lines of m-file code:
lambda=0:.01:.06;
for j=1:length(lambda)
    L = lambda(j);
so I believe that it both exists and is a scalar.

Now, if were to be calling my function(s) directly myself, I know that I could simply add my variable L in the function definition.  For example:
myilink = @(eta, L) L + (1-2*L).*normcdf(min(max(eta,lowerBnd),upperBnd));

However, since I do not control the call function within glmfit, I do not see how to pass the L variable to my function(s).

Suggestions?

Thanks in advance,
Dan