From: Ketan on
Hello,

I am getting the following error while using mnrfit.

====ERROR====
??? Error using ===> mnrfit
Inputs to mnrfit must be floats, namely single or double.

Error in ==> mnrfit at 125
dataClass = superiorfloat(x,y);
====ERROR====

The variable x is double. I tried type casting it by
x=single(x); but the error persists.

Any help will be much appreciated.

Regards,

From: Steven Lord on

"Ketan " <useless.id(a)gmail.com> wrote in message
news:g3h71p$615$1(a)fred.mathworks.com...
> Hello,
>
> I am getting the following error while using mnrfit.
>
> ====ERROR====
> ??? Error using ===> mnrfit
> Inputs to mnrfit must be floats, namely single or double.
>
> Error in ==> mnrfit at 125
> dataClass = superiorfloat(x,y);
> ====ERROR====
>
> The variable x is double. I tried type casting it by
> x=single(x); but the error persists.

Hint from the error message:

Input***_s_*** to mnrfit must be floats, namely single or double.

[Emphasis mine.]

Both the X and Y inputs to MNRFIT must be floats (i.e. single or double).
You've eliminated X as the cause of the problem, which means ...

--
Steve Lord
slord(a)mathworks.com


From: Ketan on
"Steven Lord" <slord(a)mathworks.com> wrote in message
<g3n25n$qlf$1(a)fred.mathworks.com>...
>
> "Ketan " <useless.id(a)gmail.com> wrote in message
> news:g3h71p$615$1(a)fred.mathworks.com...
> > Hello,
> >
> > I am getting the following error while using mnrfit.
> >
> > ====ERROR====
> > ??? Error using ===> mnrfit
> > Inputs to mnrfit must be floats, namely single or
double.
> >
> > Error in ==> mnrfit at 125
> > dataClass = superiorfloat(x,y);
> > ====ERROR====
> >
> > The variable x is double. I tried type casting it by
> > x=single(x); but the error persists.
>
> Hint from the error message:
>
> Input***_s_*** to mnrfit must be floats, namely single or
double.
>
> [Emphasis mine.]
>
> Both the X and Y inputs to MNRFIT must be floats (i.e.
single or double).
> You've eliminated X as the cause of the problem, which
means ...
>
> --
> Steve Lord
> slord(a)mathworks.com
>
>

Steve,

Thanks for your reply.

I tried that.

Actually at first, I was getting the following error:

??? Error using ==> mnrfit at 164
If Y is a column vector, it must contain positive integer
category numbers.

So, I type casted Y as integer. Then I get the error that I
mentioned in my earlier message, asking me to convert Y
into float. I do not understand why is this happening?

--
Ketan
From: Peter Perkins on
Ketan wrote:

> Actually at first, I was getting the following error:
>
> ??? Error using ==> mnrfit at 164
> If Y is a column vector, it must contain positive integer
> category numbers.
>
> So, I type casted Y as integer. Then I get the error that I
> mentioned in my earlier message, asking me to convert Y
> into float. I do not understand why is this happening?

From the help:

"Y is an N-by-K matrix, where Y(I,J) is the number of outcomes of the
multinomial category J for the predictor combinations given by X(I,:). The
sample sizes for each observation (rows of X and Y) are given by the row sums
SUM(Y,2). Alternatively, Y can be an N element column vector of scalar integers
from 1 to K indicating the value of the response for each observation, and all
sample sizes are taken to be 1."

I don't know what you had in Y originally, but since you got the message, "If Y
is a column vector, it must contain positive integer category numbers",
presumably you had a column vector containing something other than integer
values. The message was telling you to supply integer _values_, not an integer
array.

Hope this helps.