From: Luca Di Simone on
I am working with glmfit to perform probit regressions. I want to regress my y on just a costant but the glmfit points out that the limit is reached.

My syntax is;
[beta dev stat]=glmfit(x,[y n],'binomial','probit')

if x has not regressors, what's the function's input in place of x? and if the regression contains already a (default) constant, in such a case, how can I exclude the constant?

thanks for your help

Luca
From: Peter Perkins on
Luca Di Simone wrote:
> I am working with glmfit to perform probit regressions. I want to regress my y on just a costant but the glmfit points out that the limit is reached.
>
> My syntax is;
> [beta dev stat]=glmfit(x,[y n],'binomial','probit')
>
> if x has not regressors, what's the function's input in place of x? and if the regression contains already a (default) constant, in such a case, how can I exclude the constant?

As the help says,

>> help glmfit
GLMFIT Fit a generalized linear model.
[snip]
'constant' - specify as 'on' (the default) to include a constant
term in the model, or 'off' to omit it. The coefficient of the
constant term is the first element of B.

Or you can do this:

x = zeros(size(y,1),0)
glmfit(x,[y n],'binomial','link','probit')

But why are you using GLMFIT if you don't have any predictor variables? The only reason I can think of would be to compute some version of r-squared.
From: Luca Di Simone on
I am computing the mcfadden r^2 and I have to calculate the log likelihood of a model with only intercept. Now I used the vector of zeros as only regressor but the output of the function is that the matrix is singular to working precision.
While if I perform the regression on an specific regressor the results have not this problem.
How can I do?
thanks
Luca






Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hcs88q$qgf$1(a)fred.mathworks.com>...
> Luca Di Simone wrote:
> > I am working with glmfit to perform probit regressions. I want to regress my y on just a costant but the glmfit points out that the limit is reached.
> >
> > My syntax is;
> > [beta dev stat]=glmfit(x,[y n],'binomial','probit')
> >
> > if x has not regressors, what's the function's input in place of x? and if the regression contains already a (default) constant, in such a case, how can I exclude the constant?
>
> As the help says,
>
> >> help glmfit
> GLMFIT Fit a generalized linear model.
> [snip]
> 'constant' - specify as 'on' (the default) to include a constant
> term in the model, or 'off' to omit it. The coefficient of the
> constant term is the first element of B.
>
> Or you can do this:
>
> x = zeros(size(y,1),0)
> glmfit(x,[y n],'binomial','link','probit')
>
> But why are you using GLMFIT if you don't have any predictor variables? The only reason I can think of would be to compute some version of r-squared.