【问题标题】:Find the CDF of y = log(x) where x ~ U[0,1]找到 y = log(x) 的 CDF,其中 x ~ U[0,1]
【发布时间】:2022-12-03 21:14:31
【问题描述】:

I\'m trying to use Monte Carlo Aprox. in R in order to find a solution of this problem: I have a x ~ U(0,1 and Y=log(X). What I want obatain is an estimation of the pdf and the cdf. The problem is that My goal is obtain an estimation of the CDF without use ECDF comand. So, there is any way to aproximate my CDF without this comand? theoretically I can integrate my pdf but I don\'t know its exact shape.

In order to obtain these two I create this R code:


X = runif(1000) # a= 0 and b=1 default

sample = log(X)

hist(sample, xlim=c(-6,0), main=\"Estimated vs true pdf\", freq = FALSE, 
 axes=FALSE,  xlab=\"\", ylab=\"\")

 par(new=T)

 curve(exp(x), xlim = c(-6, 0), n = 1000, col = \"blue\" , lwd = 3,
  xlab=\"\", ylab=\"\")
 text(-1, 0.8, expression(f(x) == e^{x}), col = \"blue\")

#CDF
plot(ecdf(sample), main=\"Estimated CDF\")

Is it correct? consider that in the next point I obtain the true shape of the pdf that is f(y) = e^-y define between -inf and 0.

    标签: r statistics rstudio montecarlo


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-22
    • 1970-01-01
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多