# NOT RUN {
## Importing Data, generating BMB object
y <- importObservations(file = system.file("extdata", "twonode_example.csv",
package = "BayesMassBal"),
header = TRUE, csv.params = list(sep = ";"))
C <- matrix(c(1,-1,0,-1,0,0,1,-1,0,-1), byrow = TRUE, ncol = 5, nrow = 2)
X <- constrainProcess(C = C)
BMB_example <- BMB(X = X, y = y, cov.structure = "indep",
BTE = c(10,200,1), lml = FALSE, verb=0)
fn_example <- function(X,ybal){
cu.frac <- 63.546/183.5
feed.mass <- ybal$CuFeS2[1] + ybal$gangue[1]
## Concentrate mass per ton feed
con.mass <- (ybal$CuFeS2[3] + ybal$gangue[3])/feed.mass
## Copper mass per ton feed
cu.mass <- (ybal$CuFeS2[3]*cu.frac)/feed.mass
gam <- c(-1,-1/feed.mass,cu.mass,-con.mass,-cu.mass,-con.mass)
f <- X %*% gam
return(f)
}
rangex <- matrix(c(4.00 ,6.25,1125,1875,3880,9080,20,60,96,208,20.0,62.5),
ncol = 6, nrow = 2)
mE_example <- mainEff(BMB_example, fn = "fn_example",rangex = rangex,xj = 3, N = 15, res = 4)
# }
Run the code above in your browser using DataLab