What is happening with my density plot in R?

47 Views Asked by At

I'm trying to plot (using R), in a simple linear regression model ($Y_{ij} = \beta_i x_j + \epsilon$), an approximation of failure time, given some theoretical distribuition for $\beta_i$:

$${\text{Failure Time }}_i = {\text{Failure Threshold} \over \beta_i}$$

The purpose of this is to represent the $FT$ density without need to know its p.d.f..

Suppose $\beta_i$ has a $Normal(5, 4)$ distribuition, here is what I'm trying to do:

beta <- rnorm(100000, 5, 2) failure_time <- 15 / beta # here, 15 represents my failure threshold plot(density(failure_time), type = "l", xlim = c(-200, 200))

But, clearly, my density graph integrates more than $1$; which does not make sense.

Here is the graph that I got from R:

R Plot

And if it is possible to ask a second question, how can I plot a c.d.f. of $FT$ from this same scenario?

Thank you in advance!