# Numerical Partial Derivative Estimation – the {NNS} package

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**R-posts.com**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

`NNS (v0.5.5)`

now on CRAN has an updated partial derivative routine **. This function estimates true average partial derivatives, as well as ceteris paribus conditions for points of interest.**

`dy.d_()`

Example below on the syntax for estimating first derivatives of the function

`y = x_1^2 * x_2^2`

, for the points `x_1 = 0.5`

and **, and for both regressors**

`x_2 = 0.5`

**and**

`x_1`

`x_2`

.`set.seed(123)`

`x_1 = runif(1000)`

`x_2 = runif(1000)`

```
y = x_1 ^ 2 * x_2 ^ 2
dy.d_(cbind(x_1, x_2), y, wrt = 1:2, eval.points = t(c(.5,.5)))["First",]
[[1]]
[1] 0.2454744
[[2]]
[1] 0.2439307
```

The analytical solution for both regressors at

**is 0.25.**

`x_1 = x_2 = 0.5`

The referenced paper gives many more examples, comparing

**to kernel regression gradients and OLS coefficients.**

`dy.d_()`

For even more

`NNS`

capabilities, check out the examples at GitHub:https://github.com/OVVO-Financial/NNS/blob/NNS-Beta-Version/examples/index.md

**Reference Paper:**

Vinod, Hrishikesh D. and Viole, Fred,

*Comparing Old and New Partial Derivative Estimates from Nonlinear Nonparametric Regressions*

https://ssrn.com/abstract=3681104

**Supplemental Materials:**

https://ssrn.com/abstract=3681436

Numerical Partial Derivative Estimation – the {NNS} package was first posted on September 3, 2020 at 5:20 pm.

©2020 “R-posts.com“. Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at tal.galili@gmail.com

To

**leave a comment**for the author, please follow the link and comment on their blog:**R-posts.com**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.