How to create a QQ plot compared to a function I define? I want to create a QQ plot with my sample data compared to the PDF $e^{-y}$. My $y > 0$.
My first approach was to create a random vector of values > 0, then plug those into $e^{-y}$ to get the realizations of $e^{-y}$, and plot the data against this. 
I have been using the following R code:
values<- runif(length(dat$Cost), min = 0, max = 10)
RV <- c(exp(-values))
qqplot(dat$Cost, RV)

However, changing the max value greatly changes the shape of this QQ plot. I guess I could find the CDF of this function, and then find the range of $Y$ that most values fall into, but that still seems inefficient. Is there a R function that will create random values from a PDF I specify?
 A: The QQ-plot (short for quantile-quantile plot) is a scatter plot showing the sample quantiles of a set of data against the theoretical quantiles of a proposed distribution.  The latter are  obtained from the quantile function of the distribution, which is the function-inverse of its CDF.  In your case, you are using the proposed distribution $Y \sim \text{Exp}(1)$ which has quantile function:
$$Q(p) = -\ln(1-p) \quad \quad \text{for all } 0 < p < 1.$$
Suppose your (increasing) ordered observed data is $y_{(1)} \leqslant ... \leqslant y_{(n)}$ and you want to construct a QQ-plot against your chosen distribution.  Then taking the sample quantile for $y_{(i)}$ to be $p_{(i)} \equiv \tfrac{2i-1}{2n}$ your QQ-plot should plot the data pairs $( -\ln(1-p_{(i)}), y_{(i)} )$.
In your question you are trying to get a QQ-plot by simulating values from the proposed distribution, but since this is a simple distribution, you can just get the theoretical quantiles analytically using the above form.  This will give you a basic QQ-plot for the proposed distribution.  There are variations on this version of the QQ-plot based on different formulae for the sample quantiles, but this is a basic one that will serve as a reasonable starting point.

Example of a custom QQ plot: Here is some R code to generate a custom QQ plot from scratch, without the use of a package.  The generated plot is shown below the code.  The sample data is generated from the theoretical distribution $Y_i \sim \text{IID Exp}(1)$ for $i=1,...,40$.
#Generate data from Exp(1) distribution
set.seed(123);
DATA <- rexp(40,1);


#QQ plot of data against Exp(1) distribution
N         <- length(DATA);
PERCS     <- ((1:N)-0.5)/N;
QUANTILES <- -log(1-PERCS);
PLOTDATA <- data.frame(Sample = sort(DATA),
                       Theoretical = QUANTILES);


#Generate custom QQ plot
library(ggplot2);
theme_update(plot.title    = element_text(size = 15, hjust = 0.5),
             plot.subtitle = element_text(size = 10, hjust = 0.5),
             axis.title.x  = element_text(size = 10, hjust = 0.5),
             axis.title.y  = element_text(size = 10, vjust = 0.5),
             plot.margin   = unit(c(1, 1, 1, 1), "cm"));

QQPLOT <- ggplot(data = PLOTDATA, aes(x = Theoretical, y = Sample)) +
          geom_point(size = 2, colour = 'blue') + 
          geom_abline(intercept = 0, slope = 1, linetype = 'dashed') + 
          ggtitle('Quantile-Quantile Plot') + 
          labs(subtitle = '(Comparison to exponential distribution with unit scale)') + 
          xlab('Theoretical Quantiles') + 
          ylab('Sample Quantiles');

QQPLOT;


