[R] create a function from a model

From: jp d <yoyoq_at_yahoo.com>
Date: Wed, 16 Jul 2008 18:11:11 -0700 (PDT)

I am sure this is an obvious question,
I have a optimized model with coefficients from stepAIC. I can't figure out how to find the max value of a function with those coefficients. Its part of a dynamic web page or else i would have done it by hand. The code works fine, so you probably don't need it, but here it is:

dd<-read.csv("Guest.dat", header = TRUE, sep = "," ) res <- stepAIC(glm(Yield ~ (1 + NTP + DNA + T7pol)^2 , data=dd ), list(upper = Yield ~ (1 + NTP + DNA + T7pol )^2 , lower = Yield ~ 1 ) , trace=0 ) coef(res)

(Intercept)  NTP    DNA      T7pol   DNA:T7pol 
1776         -19   -8.64     -10      1.5    

I need the function back out
y = 1776 - 19*NTP -8.64*DNA -10*T7pol + 1.5 *DNA*T7pol in order to send it to optim() or some optimizer


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 Thu 17 Jul 2008 - 01:17:04 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 Thu 17 Jul 2008 - 01:31:47 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