Displaying 1 result from an estimated 1 matches for "bestd".
Did you mean:
best
2010 Dec 04
2
Problem storing lm() model in a list
...ut type "nmatrix.10" was supplied
Does anyone have any ideas?
Thanks,
Harold
############################################################################
polyModelSelection <- function(x,y,maxd,add.dim=F) {
dim.mult <- 0
if (add.dim) {
dim.mult = 1
}
bestD <- 1
bestError <- 1
loss <- 1
lm.models <- vector("list",maxd)
for (d in 1:maxd) {
lm.mod <- lm(y ~ 0 + poly(x,d,raw=T))
lm.models[[d]] <- lm.mod
loss[d] <- modelError(lm.mod,data.frame(x),y)+d*dim.mult
if (d == 1){...