matlab求对数正态的均值和标准差,matlab–从变量的均值,系数
⽣成对数正态分布随机数...
结果并不令⼈惊讶.对于具有⼤峰度的分布,样本⽅差的预期⽅差⼤致为mu4 / N,其中mu4是分布的第4个时刻.对于对数正态,mu4指数地取决于参数sigma ^ 2,这意味着对于⾜够⼤的sigma值,样本⽅差将相对于真实⽅差在整个地⽅.这正是你所观察到的.在你的例⼦中,mu4 / N~ (coeffOfVar ^ 8)/ N~50 ^ 8 / 1e6~4e7.
exp.var.of.samp.var
matlab生成随机数(n-1)*((n-1)*mu4-(n-3)*mu2^2)/n^3
}
mu2.lnorm
(exp(sigma^2)-1)*exp(2*mu+sigma^2)
}
mu4.lnorm
mu2.lnorm(mu,sigma)^2*(exp(4*sigma^2)+2*exp(3*sigma^2)+3*exp(2*sigma^2)-3)
}
exp.var.lnorm.var
exp.var.of.samp.var(n,mu2.lnorm(mu,sigma),mu4.lnorm(mu,sigma))
}
var
exp.var.of.samp.var(n,sigma^2,3*sigma^4)
}
coeffOfVar
mean
sigma
mu
n
m
## Get variance of sample variance for lognormal distribution:
cat("samp. variance (mean of",m,"trials):",ial),"\n")
cat("theor. variance:",mu2.lnorm(mu,sigma),"\n")
cat("variance of the sample var:",ial),"\n")
cat("expected variance of the sample var:",exp.var.lnorm.var(n,mu,sigma),"\n")
> samp. variance (mean of 10000 trials): 105.7192
> theor. variance: 100
> variance of the sample var: 350997.7
> expected variance of the sample var: 494053.2
## Do this with normal distribution:
cat("samp. variance (mean of",m,"trials):",ial),"\n")
cat("theor. variance:",sigma^2,"\n")
cat("variance of the sample var:",ial),"\n")
cat("expected variance of the sample var:",var(n,mu,sigma),"\n") > samp. variance (mean of 10000 trials): 3.257944
> theor. variance: 3.258097
> variance of the sample var: 0.002166131
> expected variance of the sample var: 0.002122826
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论