Marginal distribution of $Y$

knitr::opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE)
showplots <- FALSE

A sample was uploaded for the marginal distibution of the extension variable. Summary statistics and a histogram plot are as follows

options(digits = 4)
summary(params$ry)
library(ggplot2)
df1 <- data.frame(Y = params$ry)
ggplot(df1, aes(x = Y))+
  geom_histogram(colour = "blue", fill = "white", bins = 30) +
  labs(title = "Histogram of sampled extension variable values") +
  theme_grey(base_size = 12)

Conditional distribution of $X$, given $Y$ takes its median value $y_{0.5}$

fit <- params$fit2
bin.left <- NA
bin.right <- NA
chips <- NA
roulette <- FALSE
filename <- system.file("shinyAppFiles", "distributionsChild.Rmd", package="SHELF")

Median function

plotConditionalMedianFunction(yCP = params$yCP, xMed = params$xMed, 
                              yLimits = range(params$ry),
                              link = params$link)

Marginal distribution of X

d2 <- switch(params$d[2],"normal" = "normal",
                       "t" = "Student-t",
             "skewnormal" = "Skew normal",
                       "gamma" = "gamma",
                       "lognormal" = "log normal",
                       "logt" = "log Student-t",
                       "beta" = "beta",
                       "hist" = "histogram",
                       "best" = as.character(params$fit2$best.fitting[1, 1]),
             "mirrorgamma" = "mirror gamma",
             "mirrorlognormal" = "mirror log normal",
             "mirrorlogt" = "mirror log Student-t")

Marginal distribution of $X$, obtained using the uploaded sample for $Y$ and a r paste(d2) distribution for $X|Y$:

library(ggplot2)

ggplot(params$df1, aes(x = X, y = ..density..))+
        geom_density(fill = "steelblue")+ 
  theme_grey(base_size = 12)


OakleyJ/SHELF documentation built on May 8, 2024, 5:27 a.m.