search for: catmean

Displaying 1 result from an estimated 1 matches for "catmean".

Did you mean: catman
2006 Mar 23
0
Writing a function to fit ALSOS models. problem with normalization?
...= nx = x mx[] = 0 nx[] = 0 for (i in (1:ncol(x))[x.facs]) { # optimal scaling if (i==1) nx[,i] = ols$fitted.values else nx[,i] = (x[,1] - cbind(rep(1,nrow(x)), x[,c(-1,-i)]) %*% b[-i])/b[i] # create within-category means tmpfac = factor(ox[,i], labels=1:nlevels(ox[,i])) catmeans = tapply(nx[,i], tmpfac, mean) # ensure ordinal values are correctly ordered if (x.ords[i]) { tmp = kruskal.ordering(nx[,i], tmpfac) tmpfac = tmp$tmpfac catmeans = tmp$catmeans } # set values to within-category means mx[,i] = catmeans[tmpfac] # normalize according...