Displaying 2 results from an estimated 2 matches for "ivnames".
Did you mean:
ifnames
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
...m.labels")
[1] "log(10 + x1)" "poly(x2, 2)"
[snip]
In my working example code below , I need the help where I have "##fix
me fix me##
##Paul Johnson
## 2011-12-19
## mcDiagnose.R
lmAuxiliary <- function(model){
dat <- as.data.frame(model.matrix(model))
## ivnames <- attr(delete.response(terms(model)), "term.labels")
## previous does not work with transforms like poly
hasIntercept <- attr(terms(model), "intercept")
if (hasIntercept) dat <- dat[ , -1] # removes intercept. assumes
intercept in column 1
ivnames <- colnam...
2012 May 03
1
Proposal: model.data
...a frame
##' @export
##' @author Paul E. Johnson <pauljohn@@ku.edu>
##' @example inst/examples/model.data-ex.R
model.data <- function(model){
fmla <- formula(model)
allnames <- all.vars(fmla) ## all variable names
## indep variables, includes d in poly(x,d)
ivnames <- all.vars(formula(delete.response(terms(model))))
## datOrig: original data frame
datOrig <- eval(model$call$data, environment(formula(model)))
if (is.null(datOrig))stop("model.data: input model has no data frame")
## datOrig: almost right, but includes d in poly(...