Last line should use outside = c (0, 1). But not that important. On Sat, Jul 11, 2020 at 1:31 PM Abby Spurdle <spurdl...@gmail.com> wrote: > > NOTE: LIMITED TESTING > (You may want to check this carefully, if you're interested in using it). > > library (kubik) > library (mvtnorm) > > sim.cdf <- function (mx, my, sdx, sdy, cor, ..., n=2e5) > sim.cdf.2 (mx, my, sdx^2, sdy^2, sdx * sdy * cor, n=n) > > sim.cdf.2 <- function (mx, my, vx, vy, cov, ..., n=2e5) > { m <- c (mx, my) > v <- matrix (c (vx, cov, cov, vy), 2, 2) > u <- rmvnorm (2 * n, m, v) > for (i in 1:(2 * n) ) > u [i] <- max (0, u [i]) > z <- u [1:n] + u [(n + 1):(2 * n)] > > P0 <- sum (z == 0) / n > > z2 <- z [z != 0] > z2 <- c (-z2, z2) > de <- density (z2) > xFh <- chs.integral (de$x, de$y) > > cx <- seq (0, max (de$x), length.out=60) > cy <- xFh (cx) > cy <- cy - cy [1] > cy <- P0 + cy * (1 - P0) / cy [60] > > cs = chs.constraints (increasing=TRUE) > chs (cx, cy, constraints=cs, outside = c (0, cy [60]) ) > } > > #X1, X2 means: 0 and 2 > #X1, Y2 sds: 1.5 and 3.5 > #cor (X1, X2): 0.75 > Fh <- sim.cdf (0, 2, 1.5, 3.5, 0.75) > > plot (Fh, ylim = c (0, 1.05), yaxs="i") > > #prob 1 < U < 2 > Fh (2) - Fh (1) > > > On Sat, Jul 11, 2020 at 1:49 AM Arun Kumar Saha via R-help > <r-help@r-project.org> wrote: > > > > Hi, > > I would rather have a Statistics related question hope experts here can > > provide some suggestions. I have posted this request in some other forum > > but failed to generate meaningful response > > I am looking for some technical document on deriving the Distribution > > function for sum of 2 ReLU(𝑋)=max{0,𝑋} distributions i.e max{0,𝑋1} + > > max{0,𝑋2} where X1 and X2 jointly follow some bivariate Nomal distribution. > > There are few technical notes available for univariate ReLU distribution, > > however I failed to find any spec for bivariate/multivariate setup. > > Any pointer on above subject will be highly helpful. > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.