Given the following function:
f(x) = (1/2*pi)(1/(1+x^2/4))
How do I identify it's distribution and write this distribution function in R?
Given the following function:
f(x) = (1/2*pi)(1/(1+x^2/4))
How do I identify it's distribution and write this distribution function in R?
An off-topic question, but OK to answer without your making a new thread. Useful as it turns out subtle.
Compare
So I think
e = 1e-2
is reasonable. We could draw samples, make a (scaled) histogram and overlay density curve:So this is your function right now (hopefully you know how to write an R function; if not, check writing your own function):
f
is defined on(-Inf, Inf)
so integration on this range gives an indefinite integral. Fortunately, it approaches toInf
at the speed ofx ^ (-2)
, so the integral is well defined, and can be computed:Then you want to normalize
f
, as we know that a probability density should integrate to 1:You can draw its density by: