--- title: "Introduction to epandist" author: "Mathias Borritz Milfeldt" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to epandist} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ## The scope of this package Analyzing censored variables usually requires the use of optimization algorithms. The `epandist`-package provides an alternative algebraic approach to the task of determining the expected value of a random censored variable with a known censoring point. Likewise this approach allows for the determination of the censoring point if the expected value is known. These results are derived under the assumption that the variable follows an Epanechnikov kernel distribution with known mean and range prior to censoring. ## The Epanechnikov distribution The Epanechnikov kernel is often used in the context of non-parametric estimation. However the kernel may also be considered a distribution in its own right. The Epanechnikov "distribution" is simply a concave pylonomial of second degree. As such the distribution entails some desirable properties. For one thing it is a straight forward way of achieving an s-shaped cumulative distribution function. Furthermore the distribution allows for untroublesome calculation of the expected value of a censored variable. ```{r fig.height=4.2, fig.width=5.25} require("epandist") curve(depan(x), xlim=c(-2.5, 2.5), yaxs='i', col="blue") #Mean=0, sd=1 title("The Epanechnikov probability distribution function", cex.main=1) ``` The Epanechnikov distribution is controlled by two parameters: $\mu$ and $r$. $\;\mu$ represents the mean, mode and median, which all coincide since the distribution is symmetrical. $\;r$ represents the spread and corresponds to the distance between the mean and the smallest/largest possible value supported by the distribution, i.e. half the range. $\;r=\sqrt{5}$ yields a standard deviation of exactly 1. ## The cumulative distribution function and the quantile function The cumulative distribution function is given by $$P(X censoringpoint] <- censoringpoint #Censoring data dist_mean - mean(x) #Approximate expected abatement ``` The author finds this verification very pleasing. ### Setting the ceiling Say that the 1.4 percent expected abatement found in the previous example is considered too ambitious by policy makers. Which ceiling level corresponds to an expected abatement of exactly 1 percent? ```{r} cepan(ev=99, mu=100, r=10, side_censored = "right") #Calculate censoring point ``` Thus an emission ceiling 2.1 percent above the "main scenario"-level (i.e. at 102.1) will result in an expected abatement of 1 percent. Assuming that future emissions are subject to Epanechnikov-distributed uncertainty is of course not entirely innocent. Nevertheless this is much preferable to ignoring uncertainty altogether which regrettably is a common approach.