Every time I think I know what's going on, suddenly there's another layer of complications.
2017年4月30日星期日
2017年4月27日星期四
The idea of utility -a very interesting explanation
https://stats.stackexchange.com/a/276376/61705
"The idea of utility is very simple. It converts the numerical outcome into the utility to you. Say, you get 10 apples or 5 oranges, or some combination of two. How would you compare apples to oranges? Easy, I offer you to take either of two choices, and you pick one. So, theory goes that there's some kind of a function
So, if I feed it U(10,0) or U(0,5) , where the good 1 is apples, and the good 2 is oranges, it'll return two different numbers, the greater one will indicate which basket has more utility to you. YOu can combine goods in the same basket U(1,1) - one apple and one orange.
So, in a nutshell, the utility function is a concept that allows us to compare apples to oranges. The theory states that you pcik the baskets based on their utility, which is calculated by plugging the basket descriptions into this utility function."
2017年4月18日星期二
A function to calculate Asymptotic Relative Efficiency (ARE) of signed-rank Wilcoxon and contaminated normals
#sigma1=1 and sigma2=3
ARE_W_t<-function(epsilon){
effi<-(((1-epsilon)^2/(2*sqrt(pi))+epsilon^2/(6*sqrt(pi))+epsilon*(1-epsilon)/(2*sqrt(pi)))*sqrt(12))^2*(1+epsilon*8)
return (effi)
}
ARE_W_t<-function(epsilon){
effi<-(((1-epsilon)^2/(2*sqrt(pi))+epsilon^2/(6*sqrt(pi))+epsilon*(1-epsilon)/(2*sqrt(pi)))*sqrt(12))^2*(1+epsilon*8)
return (effi)
}
2017年4月16日星期日
A function for Walsh averages
library(Rfit)
x<-c(-4,-2,5,9)
x
walsh(x)
mywalsh<-function (x)
{
n <- length(x)
w <- vector(n * (n + 1)/2, mode = "numeric")
ind <- 0
for (i in 1:n) {
for (j in i:n) {
ind <- ind + 1
w[ind] <- 0.5 * (x[i] + x[j])
}
}
return(w)
}
mywalsh(x)
x<-c(-4,-2,5,9)
x
walsh(x)
mywalsh<-function (x)
{
n <- length(x)
w <- vector(n * (n + 1)/2, mode = "numeric")
ind <- 0
for (i in 1:n) {
for (j in i:n) {
ind <- ind + 1
w[ind] <- 0.5 * (x[i] + x[j])
}
}
return(w)
}
mywalsh(x)
2017年4月14日星期五
conditional expected value
E(E(Y|X)=E(Y)
P(A|X)=E(1A|X)
P(A)=E[P(A)|X]
http://www.math.uah.edu/stat/expect/Conditional.html#prp2
P(A|X)=E(1A|X)
P(A)=E[P(A)|X]
http://www.math.uah.edu/stat/expect/Conditional.html#prp2
2017年4月12日星期三
rank and anti-rank
x = c(-1, 5, 0, 3, 1, -2)
> rank(x) # "classical" ranking
[1] 2 6 3 5 4 1
> order(x) # anti ranking
[1] 6 1 3 5 4 2
> rank(x) # "classical" ranking
[1] 2 6 3 5 4 1
> order(x) # anti ranking
[1] 6 1 3 5 4 2
2017年4月11日星期二
订阅:
博文 (Atom)