2.1 对数正态分布不完全k阶矩公式
LN<-function(mu,sigma,L,U,k){
Lk<-(log(L)-mu)/sigma-k*sigma
Uk<-(log(U)-mu)/sigma-k*sigma
exp(k*mu+k^2*sigma^2/2)*(pnorm(Uk)-pnorm(Lk))
}
verify the pdf
LN(8.5,0.8,0,Inf,0)
exam 2.1
EX=LN(8.5,0.8,0,Inf,1)
EX1=0.75*EX
EX2=LN(8.5,0.8,0,25000,1)+25000*LN(8.5,0.8,25000,Inf,0)
exam 2.2
VARX=LN(8.5,0.8,0,Inf,2)-LN(8.5,0.8,0,Inf,1)^2
VARX1=0.75^2*VARX
EX2_SQ=LN(8.5,0.8,0,25000,2)+25000^2*LN(8.5,0.8,25000,Inf,0)
VARX2=EX2_SQ-EX2^2
VARX2
2.2 正态分布不完全k阶矩公式
2.2.0 正态分布不完全0阶矩公式:CDF
pnorm(Inf)-pnorm(0)
2.2.1 正态分布不完全1阶矩公式
norm<-function(mu=0,sigma=1,L,U){
L1<-(L-mu)/sigma
U1<-(U-mu)/sigma
mu*{pnorm(U1)-pnorm(L1)}-sigma*{dnorm(U1)-dnorm(L1)}
}
norm(,,0,1e10)
norm(,,-Inf,Inf)
2.2.2 正态分布不完全2阶矩公式
norm2<-function(mu=0,sigma=1,L,U){
L1<-(L-mu)/sigma
U1<-(U-mu)/sigma
(mu^2+sigma^2)*{pnorm(U1)-pnorm(L1)}-
sigma*{(2*mu+sigma*U1)*dnorm(U1)-(2*mu+sigma*L1)*dnorm(L1)}
}
norm2(,,0,Inf)