This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functions { | |
// the Hill function | |
real Hill(real t, real ec, real slope) { | |
return 1 / (1 + (t / ec)^(-slope)); | |
} | |
// the adstock transformation with a vector of weights | |
real Adstock(row_vector t, row_vector weights) { | |
return dot_product(t, weights) / sum(weights); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(blockmodeling) | |
stochBlock<-function(M, clu, eps=0, each=FALSE,weights=NULL, eachProb=FALSE, nMode=NULL, limits=NULL, design0=TRUE, weightClusterSize = 1){ | |
wc<-weightClusterSize | |
n<-dim(M)[1] | |
# mean05<-function(x)mean(c(x,0.5), na.rm=TRUE) | |
if(is.null(weights)){ | |
weights<-M |