Re: [R] bootpred for multinomial

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Wed, 09 Jun 2010 16:14:36 +0200

On 09.06.2010 15:15, azam jaafari wrote:
> Thank you very much
>
> I used bootpred for multinomial logistic reg. similar below:
> theta.fit<- function(x,y){lsfit(x,y)}
> theta.predict<- function(fit,x){
> cbind(1,x)%*%fit$coef
> }
> sq.err<- function(y,yhat) { (y-yhat)^2}
> results<- bootpred(x,y,20,theta.fit,theta.predict,
> err.meas=sq.err)
>
> x=data
> mlr=multinom(y~x1+x2+x3+x4+x5, data)
>
> after run results:
>> results<- bootpred(data, mlr,50,theta.fit,theta.predict, sq.err)
> Error in as.vector(data) :
> no method for coercing this S4 class to a vector
>
> Is it incorrect?

First guess: bootpred() is from the "bootstrap" packages (you just told about nnet).

 From that help page (?bootpred):
x a matrix containing the predictor (regressor) values. Each row corresponds to an observation.

And your data is some S4 class object, obviously, but bootpred expects a matrix according to the docs ....

Uwe Ligges

> Azam
>
>
>
>
>
>
>
> --- On Wed, 6/9/10, Uwe Ligges<ligges@statistik.tu-dortmund.de> wrote:
>
>
> From: Uwe Ligges<ligges_at_statistik.tu-dortmund.de>
> Subject: Re: [R] bootpred for multinomial
> To: "azam jaafari"<azamjaafari_at_yahoo.com>
> Cc: "R-help"<r-help_at_r-project.org>
> Date: Wednesday, June 9, 2010, 5:46 AM
>
>
>
>
> On 09.06.2010 13:26, azam jaafari wrote:
>> I applied bootpred for multinomial logistic reg. (with nnet package). I used same as theta.fit and theta.predict of R for my data. but give me error. Can I do this with
>> response vriable;7 levels
>> predictor variables:5 (1 classifier, 4 continuous)?
>>
>> Thanks alot
>> Azam
>>
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>>
>>
>>
>> ______________________________________________
>> R-help_at_r-project.org 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.
>
>
> Yes, PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented,
> minimal, self-contained, reproducible code.
>
> otherwise it is hard to help without your code and without any error
> message.
>
> Uwe Ligges
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help_at_r-project.org 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.



R-help_at_r-project.org 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. Received on Wed 09 Jun 2010 - 14:17:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jun 2010 - 14:50:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive