0

I would like to find out the x^2 density distribution by given x distribution. Currently my samples fall into triangular distribution(min = 1, max = 6, mode = 3). How to generate samples for x^2 distribution given x distribution is triangular in r ? Any help will be appreciate it.

library(ExtraDistr) 
sample_size <- 100
x <-  rtri(sample_size, 1, 6, 3)  # ExtraDistr::triangular distribution (min, max, mode)

I can figure out by hand using inverting CDF. But it will give back two pdf functions. I do not know how to convert to sampling in R when there are two functions , which one x falls into (1,9), then another is in (9,36). Should I have half sample size for each pdf ?

mkl
  • 90,588
  • 15
  • 125
  • 265
CindyJ
  • 1
  • 2

0 Answers0