Hi,

How do I use a function inside a regression formula? When I tried to use
min() function inside a regression formula,  I ran into errors.   Here are
the commands to reproduce the error:


mydata <- read.csv(url("http://www.ats.ucla.edu/stat/r/dae/binary.csv"))

attach(mydata)

names(mydata)

mylm2 = lm(admit~gre+I(max(gpa,rank)))

*Error in model.frame.default(formula = admit ~ gre + I(max(gpa, rank)),  :
  variable lengths differ (found for 'I(min(gpa, rank))')*

*
*

*
*

Regards,

David

	[[alternative HTML version deleted]]

