Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

glmfit and standardized regression coefficients

260 views
Skip to first unread message

cyd

unread,
Aug 23, 2009, 12:29:02 AM8/23/09
to
Hi eveyone,

I use glmfit function to find the deviation of logistic regression model. Now I would like to calculate the standardized regression coefficients (beta coefficients) for logistic regression. Is it possible with glmfit function, if it is , could you expain the usage of it ?

Best wishes,

cyd

Tom Lane

unread,
Aug 24, 2009, 10:49:12 AM8/24/09
to

Cyd, if you mean "beta coefficients" the way I understand the term, that
just indicates you want to standardize the predictors before passing them
into glmfit. Try "help zscore" for a utility that might be useful.

-- Tom


cyd

unread,
Aug 24, 2009, 12:00:21 PM8/24/09
to
hi Tom, thanks for the reply. In a regression model standardized coefficients are used to compare the predictors in different units. Like normal coefficients (b) cant we calculate the standardized coefficients unless standardize the data ? Becuse there is a formula to calculate the standardized coefficients by knowing the standart deviaiton and mean of each predictor. Is there a way to automacially calculate standardized coefficients. ?

thanks in advance ,

cyd


"Tom Lane" <tl...@mathworks.com> wrote in message <h6u998$bab$1...@fred.mathworks.com>...

cyd

unread,
Aug 24, 2009, 12:45:18 PM8/24/09
to
In glmfit function with stats. beta I can obtain the beta coefficients but this is same with the b coefficients, what I try to do is obtain the standardized coefficients. with the help of standardized coefficients I can see what is the impact of one item change in standart deviation into Y variable.

"cyd " <ceyd...@su.sabanciuniv.edu> wrote in message <h6udel$j8m$1...@fred.mathworks.com>...

Tom Lane

unread,
Aug 24, 2009, 1:04:18 PM8/24/09
to
> hi Tom, thanks for the reply. In a regression model standardized
> coefficients are used to compare the predictors in different units. Like
> normal coefficients (b) cant we calculate the standardized coefficients
> unless standardize the data ? Becuse there is a formula to calculate the
> standardized coefficients by knowing the standart deviaiton and mean of
> each predictor.

Sure:
>> x = 100*rand(100,1);
>> y = 1000 + x + 20*randn(size(x));
>> b = glmfit(x,y)
b =
999.232694590709
1.02616142726692
>> beta = glmfit(zscore(x),y)
beta =
1050.88079622223
29.1599370794729
>> b(2) * std(x)
ans =
29.1599370794729

To compute the intercept you'd have to adjust for the mean of x. And models
with multiple predictors can be handled in a similar way.

> Is there a way to automacially calculate standardized coefficients. ?

No, not if you are asking about an option of the glmfit function to compute
them. In another post you mentioned the beta field in the stats structure,
but that's just the name used for the regular coefficients in that
structure.

-- Tom

cyd

unread,
Aug 24, 2009, 3:22:04 PM8/24/09
to
thanks a lot for the answer Tom, but is it enogh to only adjuct the x variable to obtain standardized coefficients, is it necessart to adjust the y variable? And I have another problem with zscore because my data includes blank in come rows and columns missing datas, I suppose because of this reason the resut of zscore is NAN. How can I handle this problem.

again thank you very very much for your interest.

"Tom Lane" <tl...@mathworks.com> wrote in message <h6uh6j$m52$1...@fred.mathworks.com>...

Tom Lane

unread,
Aug 25, 2009, 9:56:45 AM8/25/09
to
> thanks a lot for the answer Tom, but is it enogh to only adjuct the x
> variable to obtain standardized coefficients, is it necessart to adjust
> the y variable? And I have another problem with zscore because my data
> includes blank in come rows and columns missing datas, I suppose because
> of this reason the resut of zscore is NAN. How can I handle this problem.

Cyd, you won't need to adjust y, if I understand the concept of beta
coefficients correctly.

There are two things you could do if you have missing (NaN) data. One is to
compute the mean and standard deviation with nanmean and nanstd, then
standardize yourself. You might find it simplest to loop over the columns,
though if you're familiar with bsxfun that allows you to do it without
looping. The other idea, if you're comfortable with editing toolbox files,
is to change zscore to use nanmean and nanstd.

-- Tom


0 new messages