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

Thread Subject:
leverage / cooks distance, glmfit

Subject: leverage / cooks distance, glmfit

From: Ingrid

Date: 5 Jul, 2013 01:52:08

Message: 1 of 5

Hello,

I have been using "glmfit" to perform binomial regression and I need to be able to get some extra diagnostics out of this namely

the leverage values,
and / or Cook's distance.

I see such outputs are available when using GeneralizedLinearModel.fit, I tried to apply this as a complement to glmfit but I get the following error:

mdl=GeneralizedLinearModel.fit(XX,[Y nTotal],'Distribution',binomial,'Link',logit)

Error using classreg.regr.FitObject/subsasgn
Assignment using () is not allowed for a FitObject.

Can anyonbe help?

Many thanks,
IC

Subject: leverage / cooks distance, glmfit

From: Steven_Lord

Date: 8 Jul, 2013 18:16:11

Message: 2 of 5



"Ingrid " <i.charvet@ucl.ac.uk> wrote in message
news:kr58s8$hn6$1@newscl01ah.mathworks.com...
> Hello,
>
> I have been using "glmfit" to perform binomial regression and I need to be
> able to get some extra diagnostics out of this namely
>
> the leverage values,
> and / or Cook's distance.
>
> I see such outputs are available when using GeneralizedLinearModel.fit, I
> tried to apply this as a complement to glmfit but I get the following
> error:
>
> mdl=GeneralizedLinearModel.fit(XX,[Y
> nTotal],'Distribution',binomial,'Link',logit)

You're missing single quotes around binomial and logit.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: leverage / cooks distance, glmfit

From: Ingrid

Date: 9 Jul, 2013 01:19:10

Message: 3 of 5

"Steven_Lord" <slord@mathworks.com> wrote in message <krevlb$lsv$1@newscl01ah.mathworks.com>...
>
>
> "Ingrid " <i.charvet@ucl.ac.uk> wrote in message
> news:kr58s8$hn6$1@newscl01ah.mathworks.com...
> > Hello,
> >
> > I have been using "glmfit" to perform binomial regression and I need to be
> > able to get some extra diagnostics out of this namely
> >
> > the leverage values,
> > and / or Cook's distance.
> >
> > I see such outputs are available when using GeneralizedLinearModel.fit, I
> > tried to apply this as a complement to glmfit but I get the following
> > error:
> >
> > mdl=GeneralizedLinearModel.fit(XX,[Y
> > nTotal],'Distribution',binomial,'Link',logit)
>
> You're missing single quotes around binomial and logit.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Thank you it is true I was missing the quotes!
However I have now put them in and I still get the same error?

Subject: leverage / cooks distance, glmfit

From: Ingrid

Date: 9 Jul, 2013 01:29:17

Message: 4 of 5

"Steven_Lord" <slord@mathworks.com> wrote in message <krevlb$lsv$1@newscl01ah.mathworks.com>...
>
>
> "Ingrid " <i.charvet@ucl.ac.uk> wrote in message
> news:kr58s8$hn6$1@newscl01ah.mathworks.com...
> > Hello,
> >
> > I have been using "glmfit" to perform binomial regression and I need to be
> > able to get some extra diagnostics out of this namely
> >
> > the leverage values,
> > and / or Cook's distance.
> >
> > I see such outputs are available when using GeneralizedLinearModel.fit, I
> > tried to apply this as a complement to glmfit but I get the following
> > error:
> >
> > mdl=GeneralizedLinearModel.fit(XX,[Y
> > nTotal],'Distribution',binomial,'Link',logit)
>
> You're missing single quotes around binomial and logit.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

actually I realized I get this problem only when I use this expression in a loop,

for i=1:n
mdl(i)=GeneralizedLinearModel.fit(XX,[Y(:,i) nTotal],'Distribution','binomial','Link','logit')
end

if I calculate mdl one by one its fine. Maybe its due to mdl(i)?

Subject: leverage / cooks distance, glmfit

From: Steven_Lord

Date: 9 Jul, 2013 14:31:01

Message: 5 of 5



"Ingrid " <i.charvet@ucl.ac.uk> wrote in message
news:krfp1d$n5n$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <krevlb$lsv$1@newscl01ah.mathworks.com>...

*snip*

> actually I realized I get this problem only when I use this expression in
> a loop,
>
> for i=1:n
> mdl(i)=GeneralizedLinearModel.fit(XX,[Y(:,i)
> nTotal],'Distribution','binomial','Link','logit')
> end
>
> if I calculate mdl one by one its fine. Maybe its due to mdl(i)?

You can't create an array of GeneralizedLinearModel objects. Create a cell
array of GeneralizedLinearModel objects instead.

mdl = cell(1, n);
for k=1:n
    mdl{k}=GeneralizedLinearModel.fit(XX,[Y(:,k)
nTotal],'Distribution','binomial','Link','logit');
end

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us