getModelFrame {gnm} | R Documentation |
A utility function to enable gnm
plug-in functions to get the
model frame in use by gnm
.
getModelFrame()
The model frame in use by gnm
.
This function is only designed to work from within a plug-in
function. To extract the model frame from a gnm
object, use
model.frame
.
Heather Turner
## Create a dummy plug-in function dummy <- function(...) { cat("Model frame:\n") print(getModelFrame()[1:5,]) stop("Not a valid plug-in function, model can not be estimated") } ## Use data from Vargas et al (2001) set.seed(1) data(wheat) yield.scaled <- wheat$yield * sqrt(3/1000) treatment <- factor(paste(wheat$tillage, wheat$summerCrop, wheat$manure, wheat$N, sep = "")) ## Add dummy nonlinear term to main effects model - the dummy function ## gets the model frame used by gnm and prints the first 5 rows mainEffects <- try(gnm(yield.scaled ~ year + treatment + Nonlin(dummy(as.numeric(year), N, scale(MTD))), family = gaussian, data = wheat))