Skip to content

Commit

Permalink
fix(?) for bootstrapped conditional means meta-regression
Browse files Browse the repository at this point in the history
  • Loading branch information
bwallace committed Apr 25, 2016
1 parent 26b9f3c commit f01c22e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/R/openmetar/R/meta_reg.r
Expand Up @@ -725,6 +725,7 @@ g.bootstrap.meta.regression.cond.means <- function(
res.tmp <- tryCatch({
regression.wrapper(data[indices,], mods.str, method, level, digits,btt)
}, error = function(e) {
print("FAILURE FAILURE FAILURE")
failures <<- failures + 1
indices <- sample.int(nrow(data), size=length(indices), replace=TRUE)
cat("Error in regression wrapper: ",e$message,"\n")
Expand All @@ -733,16 +734,21 @@ g.bootstrap.meta.regression.cond.means <- function(
# Everything worked alright
ok <- TRUE
} # end while

tmp.betas <- A %*% res.tmp$b
tmp.betas[,1]

}

subset.ok <- function(data, indices) {
# Are all the categorical levels present in the subset?
data.subset = data[indices,]

for (mod in mods[["categorical"]]) {
n.levels <- length(unique(data[[mod]]))
# issue #205 (OpenMEE) -- to be changed data to data.subset
# here to make sure all levels are present in
# the sample
n.levels <- length(unique(data.subset[[mod]]))
if (n.levels != cat.mods.level.counts[[mod]]) {
return(FALSE)
}
Expand Down

0 comments on commit f01c22e

Please sign in to comment.