[R] Convert numeric to factor

From: Haibo Huang <edhuang00_at_yahoo.com>
Date: Thu 04 Aug 2005 - 06:52:13 EST


Hi,

I tried to do a logistic regression with polr(MASS). I thought I already converted the response to factor, but obvious I was wrong. Could anyone tell me what I did wrong and how to correct it? Thank you very much!

> Lease=read.csv("LeaseDummy.csv", header=TRUE)
> Lease$ID <-

as.integer(factor(Lease$EarlyTermination))
>
>

RegA=polr(ID~1+MSA+SIC.Code+TenantOption+LLOption+TOExercised,

+ data=Lease, method=c("logistic"))
Error in polr(ID ~ 1 + MSA + SIC.Code + TenantOption + LLOption + TOExercised, :

        response must be a factor
> summary(RegA)

Best,
Ed.

>
> if labda is the elements of the vector and you know
> what kexp is , you can
> use apply
>
> apply(your_vector, 1, function(x) 1-
> exp^(kexp^(-x)))
>
>
> HTH
>
> Jean
> On Wed, 3 Aug 2005, Rangesh Kunnavakkam wrote:
>
> > I have a large vector of around 12597 elements
> and I wish to calculate
> > p-value for each element using a formula of
> something like:
> > p-value= 1-
> exp^(kexp^(-labda))
> > I was wondering someone could give some ideas how
> to implement for each element.
> > thankyou very much
> > Rangesh.K
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> >
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 04 07:05:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:40 EST