Displaying 5 results from an estimated 5 matches for "checkmfclass".
Did you mean:
checkmfclasses
2003 Nov 11
0
Mismatches in predict(newdata)
...olumn got converted to by
contrasts<-). However, the problem is more general and I have added to
R-devel a layer of protection.
When model.frame is called, it adds to its terms attribute an attribute
"dataClasses", and this can be checked against the newdata argument by a
call to .checkMFClasses: see lm and predict.lm for how to do so.
Developers who use predict(newdata) may wish to add such code to their
packages. (You can use
if (!is.null(cl <- attr(Terms, "dataClasses")) &&
exists(".checkMFClasses", envir=NULL))
.chec...
2007 May 31
1
predict.nls - gives error but only on some nls objects
........
> predict(fm2DNase1,newdata=fm2DNase1)
Error in if (sum(wrong) == 1) stop(gettextf("variable '%s' was fitted with class \"%s\" but class \"%s\" was supplied", :
missing value where TRUE/FALSE needed
What causes the trouble is the call to .checkMFClasses(cl, newdata) in predict.nls.
Incidently, on the predict.nls page the example works:
> fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
> predict(fm)
[1] 7.887449 12.524977 15.251673 16.854870 17.797490 18.677580
> predict(fm,newdata=BOD)
[1]...
2006 Mar 09
0
variable '%s' was fitted with class... in predict.nls()
...amined the code (online) I found the following:
I've trid to decipher the code, but most people are much better R
programmers that I, and I'm not sure what's going on here. DOes this mean
I have to use the same data frame I used to fit the model, in order to fit
"new" data?
.checkMFClasses <- function(cl, m, ordNotOK = FALSE)
{
new <- sapply(m, .MFclass)
if(length(new) == 0) return()
old <- cl[names(new)]
if(!ordNotOK) {
old[old == "ordered"] <- "factor"
new[new == "ordered"] <- "factor"
}...
2007 May 01
1
Levels attribute in integer columns created by model.frame()
The following is evidence of what is surely an undesirable feature.
The issue is the handling, in calls to model.frame(), of an
explanatory variable that has been derived as an unclassed
factor. (Ross Darnell drew this to my attention.)
## Data are slightly modified from p.191 of MASS
> worms <- data.frame(sex=gl(2,6), Dose=factor(rep(2^(0:5),2)),
+
2008 Nov 28
2
AIC function and Step function
I would like to figure out the equations for calculating "AIC" in both
"step() function" and "AIC () function". They are different. Then I
just type "step" in the R console, and found the "AIC" used in "step()
function" is "extractAIC". I went to the R help, and found:
"The criterion used is
AIC = - 2*log L + k *