I am trying to write the following code in R. The code works in S+ and i am trying to do the program in R. x=discrim(admit~gpa+gmat,prior=c("uniform"),data=data.mm) i wrote the following in R: x=lda(admit~gpa+gmat,data=data.mm) i could not figure out how to write prior=c("uniform") in R. I would get an error every time. I think that it has something to do with "uniform". Do you know what i use instead of "uniform" for R? I am trying to do a uniform distribution. Thank you.
> i could not figure out how to write prior=c("uniform") in R. I would get > an error every time. I think that it has something to do > with "uniform". Do you know what i use instead of "uniform" for R? I am > trying to do a uniform distribution.try ?runif (random uniform distribution)
There is a help page for lda: please read it for yourself (as the posting guide requests you too). lda in R works the same way in R as it works in S-PLUS: in both it is support software for a book, and the posting guide also asks you to read that book. On Sat, 12 Jun 2004, Martin Willett wrote:> > I am trying to write the following code in R. The code works in S+ and i > am trying to do the program in R. > > x=discrim(admit~gpa+gmat,prior=c("uniform"),data=data.mm) > > i wrote the following in R: > > x=lda(admit~gpa+gmat,data=data.mm) > > i could not figure out how to write prior=c("uniform") in R. I would get > an error every time. I think that it has something to do > with "uniform". Do you know what i use instead of "uniform" for R? I am > trying to do a uniform distribution.-- Brian D. Ripley, ripley at stats.ox.ac.uk 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
Seems rather straightforward to me. The prior="uniform" in discrim() says to use equal prior for each group. You can do the same by explicitly specifying the priors; e.g., x <- lda(admit ~ gpa + gmat, data=data.mm, prior=1/nlevels(data.mm$admit)) HTH, Andy> From: Martin Willett > > I am trying to write the following code in R. The code works > in S+ and i > am trying to do the program in R. > > x=discrim(admit~gpa+gmat,prior=c("uniform"),data=data.mm) > > i wrote the following in R: > > x=lda(admit~gpa+gmat,data=data.mm) > > i could not figure out how to write prior=c("uniform") in R. > I would get > an error every time. I think that it has something to do > with "uniform". Do you know what i use instead of "uniform" > for R? I am > trying to do a uniform distribution. > Thank you.