How can I fit a weibull distribution based on the output of its pdf? I have values which approximate the output of pdf(x) for a distribution over a range of x. I would like to determine the parameters of the two-parameter Weibull distribution which best fits these values.
I know how to use the MLE or the graphical method to fit a Weibull distribution to actual values, and I know how to estimate Weibull parameters from a mean and standard deviation using the Method of Moments, but how can I fit a Weibull distribution when I haven't got actual data but do have a table of approximate pdf output?
Would rearranging the pdf work? There won't be a perfect fit.
I could generate random numbers using the values I have, but then I'm going to have a slightly different answer each time, which I want to avoid.
Example of the values I have:
x   pdf(x)
0   0.000000
1   0.027007
2   0.052624
3   0.074020
4   0.089381
5   0.097911
6   0.099809
7   0.096072
8   0.088173
9   0.077720
10  0.066170
11  0.054668
12  0.043989
13  0.034573
14  0.026592
15  0.020043
16  0.014815
17  0.010742
18  0.007641
19  0.005333
20  0.003653

 A: Yes, you can sample from the distribution and then fit your distribution to the sampled values as described in here. On another hand, you can treat the pairs of points $(x_i, p_i)$ as your data and simply fit a curve described by a probability density function $f$ to such data by finding it's parameters $\theta$, such that they minimize some loss function $L(\cdot,\cdot)$ (e.g. squared loss), i.e. take
$$
\DeclareMathOperator*{\argmin}{arg\,min}
\hat \theta = \argmin_\theta \sum_i L\left(p_i,\, f(x_i; \theta) \right)
$$
This is very basic curve fitting.
set.seed(123)
# generate fake data
x <- rweibull(500, 5, 4)
fx <- hist(x, 100, freq = FALSE)

fitCurve <- function(x, px, pdf, par) {
  optfun <- function(par) sum((px - do.call(pdf, c(x = list(x), par)))^2) # loss function
  optim(par, optfun) # black-box optimizer
}

fit <- fitCurve(fx$mids, fx$density, dweibull, list(shape = 1, scale = 1))

that estimates
> fit
$par
   shape    scale 
5.407934 4.039310


A: You can use fitting in a number of ways, and Tim's approach should work fine.
I'll use the notation at the Wikipedia page for the Weibull, which uses scale $\lambda$ and shape $k$.
I'm going to talk about a starting value for $\lambda$ and hence for $k$ in your optimization.
Assuming your density values are accurate you can get really good starting values quite easily.
Note that the $1-1/e\approx 0.632$ -quantile of a Weibull is $\lambda$ for any $k$. This is very handy!
Summing your unit-spaced pdf values will give an approximation to the cdf. If your spacings are at interval $h$ you'll need to multiply the sum by $h$ (e.g. if you have values at $x=0.1, 0.2, 0.3, ...$ instead their sum will be about ten times the cdf, and multiplying by the step-interval of $0.1$ takes it back to about right.
So now we have the cdf, find the value where the cdf is close to $0.632$ (in your data this happens at $x=8$ where the sum is about $0.625$.  So your initial guess at $\lambda$ for the optimization ($\lambda_0$) would be around $8$ in this case.
Now look back to where your cdf is close to $0.5$ (i.e. we're trying to find the median, and we'll call our guess at the median $m_0$). In your data this is between 6 and 7 but it looks like it will exceed 6.5. Let's roughly say $m_0\approx 6.7$. Since the median for a Weibull is $\lambda \log(2)^{1/k}$ then we should have $k_0$ about $\log(\log(2))/\log(m_0/\lambda_0)$, which is roughly $2$. 
A reasonableness check: the mode should be at $\lambda(1-\frac{1}{k})^{1/k}$ which for those starting values is about $5.66$. The highest value we have is at $6$ and it looks like the true mode should be to its left ... so that's not unreasonable. 
These values should be good start values for an optimization routine for your data.
