Learn R Programming

gnm (version 0.8-1)

getModelFrame: Get the Model Frame in Use by 'gnm'

Description

A utility function to enable gnm plug-in functions to get the model frame in use by gnm.

Usage

getModelFrame()

Arguments

Value

  • The model frame in use by gnm.

See Also

gnm, Dref, MultHomog

Examples

Run this code
## Create a dummy plug-in function
dummy <- function(...) {
    cat("Model frame:
")
    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))

Run the code above in your browser using DataLab