Clear Filters
Clear Filters

I used "[b,​ats]=glmfi​t(b1,a1,'b​inomial')" function, and it has an error..

7 views (last 30 days)
I used "[b,dev.stats]=glmfit(b1,a1,'binomial')" function, and it has an error..
a1 and b1 are 131472*1 matrix.
When I used "glmfit" function, it says errors like below..
Would you please help me ?
Error using glmfit (line 187)
Y must contain values in the interval [0,N] for the binomial distribution.
Error in Untitled7 (line 4)

Accepted Answer

the cyclist
the cyclist on 2 Dec 2022
You should carefully read and understand this section of the documentation for glmfit, which specifies what is expected for the second input to glmfit, when the distribution is binomial.
Quoting that section, y needs to be
"y is an n-by-1 vector indicating success or failure at each observation, or an n-by-2 matrix whose first column indicates the number of successes for each observation and second column indicates the number of trials for each observation"
It seems that you have not used one of those two conventions.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!