Displaying 2 results from an estimated 2 matches for "fvarlist".
Did you mean:
varlist
2005 Mar 17
1
Cross validation, one more time (hopefully the last)
...roximately correct?
Thanks
T
------------------------------------------------
logcv <- function(mdata, formula, rvar, fvar) {
require(Hmisc)
# sort by fold variable
sorted <- mdata[order(mdata$fvar), ]
# get fold values and count for each group
vardesc <- describe(sorted$fvar)$values
fvarlist <- as.integer(dimnames(vardesc)[[2]])
k <- length(fvarlist)
countlist <- vardesc[1,1]
for (i in 2:k)
{
countlist[i] <- vardesc[1,i]
}
n <- length(sorted$fvar)
# fit to all the mdata
fit.all <- glm(formula, sorted, family=binomial)
pred.all <- ifelse( predict(fit.all, type=&quo...
2005 Mar 18
2
logistic model cross validation resolved
...'recordyear'
logerrorest <- function(mdata, form, rvar, fvar) {
require(Hmisc)
require(ipred)
# determine index of variables
rpos <- match(rvar, names(mdata))
fpos <- match(fvar, names(mdata))
# get fold values and count for each group
vardesc <- describe(mdata[[fpos]])$values
fvarlist <- as.integer(dimnames(vardesc)[[2]])
k <- length(fvarlist)
countlist <- vardesc[1,1]
for (i in 2:k)
{
countlist[i] <- vardesc[1,i]
}
n <- length(mdata[[fpos]])
# get index list for each fold
cc <- list()
for (i in 1:k)
{
cc[[i]] <- as.integer(rownames(mdata[mdata[[fpos]] ==...