title: Generating random variables from a mixture of Weibull(0,1) and Uniform(0,1)
body: <p>How would I create an R code algorithm to sample a mixture distribution of a truncated <em>Weibull(0,1)</em> and a <em>Uniform(2,4)</em>. The main part that is giving me difficulties is the truncated Weibull distribution. Typically, the Weibull distribution is defined on the positive real line so I can't use the built in functions that R provides. The mixture distribution is as follows:</p>
  
  <blockquote>
    <p>f(x) = 0.3 × Weibull(0,1) + 0.7 ×U(2,4)</p>
  </blockquote>
  
  <p>note: the truncated Weibull's distribution is as follows:</p>
  
  <blockquote>
    <p>f(x; k, λ) = c(k/λ)[(x/λ)^(k−1)]exp{−(x/λ)^k}, x ∈ (0, 1)</p>
  </blockquote>
  
  <p>where </p>
  
  <blockquote>
    <p>c=1/{1 − exp(−1/(λ^k))}</p>
  </blockquote>