Abstract: The main purpose in this paper is to study to what extent accessibility to R&D can explain patent production. Therefore a knowledge production function is estimated both on aggregated level and for different industrial sectors. The output of the knowledge production is the number patent applications in Swedish municipalities from 1994 to 1999. In order to account for the importance of proximity, the explanatory variables are expressed as accessibilities to university and company R&D. The total accessibility is then decomposed into local, intra-regional and inter-regional accessibility to R&D. As often is the case with R&D outputs, the regional distribution of patents is highly skewed with influential outliers. The estimations are therefore conducted with quantile regressions. The main results on aggregated level indicate that high accessibility (local) to company R&D has the greatest positive effects on patent production. The effects are statistically significant for municipalities with a patent production corresponding to the median and to quantiles above the median. Local accessibility to university R&D is only of importance for certain industrial sectors and not on aggregated level. There is also evidence that intra-regional accessibility to company R&D affects patent production positively. A conclusion is that concentrated R&D investments in companies situated in municipalities with a high patenting activity would not only gain the municipalities themselves, but also the patent production in other municipalities in the functional region.