glmpath error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

glmpath error

Tirthadeep

Hi,

I am using glampath package for L1 regularized logistic regression. I got the following error messege.

> model.fit <- glmpath(train.data[,1:20], train.data$RES, family=binomial)
Error in one %*% x : requires numeric matrix/vector arguments

where train.data is a 700X21 matrix and 21st column in response (RES).

Please clarify!!!

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: glmpath error

Duncan Murdoch
Tirthadeep wrote:

> Hi,
>
> I am using glampath package for L1 regularized logistic regression. I got
> the following error messege.
>
>  
>> model.fit <- glmpath(train.data[,1:20], train.data$RES, family=binomial)
>>    
> Error in one %*% x : requires numeric matrix/vector arguments
>
> where train.data is a 700X21 matrix and 21st column in response (RES).
>  
If it is a matrix, then train.data$RES won't work.  That column
selection method only works for data frames,
because they are lists, and matrices aren't.

Duncan Murdoch
> Please clarify!!!
>
> Thanks
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: glmpath error

Duncan Murdoch
On 9/19/2007 7:46 AM, Tirthadeep wrote:
> Then what is the solution?

The same method you used for the other columns:

train.data[,21]

Duncan Murdoch

>
>
>
>
> Duncan Murdoch-2 wrote:
>>
>> Tirthadeep wrote:
>>> Hi,
>>>
>>> I am using glampath package for L1 regularized logistic regression. I got
>>> the following error messege.
>>>
>>>  
>>>> model.fit <- glmpath(train.data[,1:20], train.data$RES, family=binomial)
>>>>    
>>> Error in one %*% x : requires numeric matrix/vector arguments
>>>
>>> where train.data is a 700X21 matrix and 21st column in response (RES).
>>>  
>> If it is a matrix, then train.data$RES won't work.  That column
>> selection method only works for data frames,
>> because they are lists, and matrices aren't.
>>
>> Duncan Murdoch
>>> Please clarify!!!
>>>
>>> Thanks
>>>
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: glmpath error

P Ehlers
In reply to this post by Duncan Murdoch
Is train.data a *numeric* matrix?

Peter Ehlers

Tirthadeep wrote:

> Then what is the solution?
>
>
>
>
> Duncan Murdoch-2 wrote:
>> Tirthadeep wrote:
>>> Hi,
>>>
>>> I am using glampath package for L1 regularized logistic regression. I got
>>> the following error messege.
>>>
>>>  
>>>> model.fit <- glmpath(train.data[,1:20], train.data$RES, family=binomial)
>>>>    
>>> Error in one %*% x : requires numeric matrix/vector arguments
>>>
>>> where train.data is a 700X21 matrix and 21st column in response (RES).
>>>  
>> If it is a matrix, then train.data$RES won't work.  That column
>> selection method only works for data frames,
>> because they are lists, and matrices aren't.
>>
>> Duncan Murdoch
>>> Please clarify!!!
>>>
>>> Thanks
>>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: glmpath error

Prof Brian Ripley
In reply to this post by Duncan Murdoch
On Wed, 19 Sep 2007, Duncan Murdoch wrote:

> On 9/19/2007 7:46 AM, Tirthadeep wrote:
>> Then what is the solution?
>
> The same method you used for the other columns:
>
> train.data[,21]

However, the error message is about the first argument (x) and not NULL
for the second argument (and applying $ to a matrix will give a warning in
recent versions of R).

I think it most likely that train.data is a data frame, in which case the
problem lies in the first argument.  glmpath makes no attempt to coerce
its arguments to the desired form, so you do need to supply exactly what
the help page says.  (Although it does not say x should be numeric, it
does need to be.)

>
> Duncan Murdoch
>
>>
>>
>>
>>
>> Duncan Murdoch-2 wrote:
>>>
>>> Tirthadeep wrote:
>>>> Hi,
>>>>
>>>> I am using glampath package for L1 regularized logistic regression. I got
>>>> the following error messege.
>>>>
>>>>
>>>>> model.fit <- glmpath(train.data[,1:20], train.data$RES, family=binomial)
>>>>>
>>>> Error in one %*% x : requires numeric matrix/vector arguments
>>>>
>>>> where train.data is a 700X21 matrix and 21st column in response (RES).
>>>>
>>> If it is a matrix, then train.data$RES won't work.  That column
>>> selection method only works for data frames,
>>> because they are lists, and matrices aren't.
>>>
>>> Duncan Murdoch
>>>> Please clarify!!!
>>>>
>>>> Thanks
>>>>
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.