Nothing
alt <- matrix(c(5.2, 4.3, 6.7,
1.3, 2.5, 4.0), ncol = 2, nrow = 3)
# alt <- matrix(c(rnorm(4000)), ncol = 2, nrow = 2000)
#
# b <- c(0.25, 0.25)
#
# usualpref1 <- function(x, j, k){
# ifelse(alt[j, k] - x >= 0, 1, 0)
# }
#
# usualpref2 <- function(x, k){
# ifelse(alt[, k] - x >= 0, 1, 0)
# }
#
# x <- 2
#
# integrand <- function(x){
# (1/sqrt(2*pi))*sum(exp(-0.5*((usualpref1(x, 1, 1) - usualpref2(x, 1))/b[k])^2))*usualpref1(x, 1, 1)
# }
#
# integrate(integrand, 0, 1)$value
#####################################
datMat <- matrix(c(5.2, 4.3, 6.7,
1.3, 2.5, 4.0), ncol = 2, nrow = 3)
band <- c(0.25, 0.1)
k <- 1
plus <- c(rep(NA, nrow(datMat)))
minus <- c(rep(NA, nrow(datMat)))
#y <- NULL
#x <- 0
usualpref <- function(x,w){
ifelse(w - x >= 0, 1, 0)
}
for(k in 1:ncol(datMat)){
z <- data.frame(datMat)[1, k]
y <- datMat[,k]
plus <- apply(data.frame(y), 1, function(w){
integrand <- function(x){
(1/sqrt(2*pi))*sum(exp(-0.5*((usualpref(x,z) - usualpref(x,y))/band[k])^2))*usualpref(x,z)
}
plus[k] <- integrate(integrand, 0, 1)$value
# })
}
)}
for(k in 1:ncol(datMat)){
z <- data.frame(datMat)[1, k]
y <- datMat[,k]
minus <- apply(data.frame(y), 1, function(w){
integrand <- function(x){
(1/sqrt(2*pi))*sum(exp(-0.5*((usualpref(z,x) - usualpref(y,x))/band[k])^2))*usualpref(z,x)
}
minus[k] <- integrate(integrand, 0, 1)$value
}
)}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.