Learn R Programming

dsfa (version 2.0.2)

derivs_transform: derivs_transform

Description

Transforms a derivs object via the specified function and applies the chainrule.

Usage

derivs_transform(f, type, par, tri, deriv_order)

Value

Returns an object of class derivs

Arguments

f

derivs object.

type

string, specifies the transformation function. Available are:

  1. `identity`: \(f(x)=x\).

  2. `exp`: \(f(x)=\exp\{x\}\).

  3. `log`: \(f(x)=\log\{x\}\).

  4. `glogit`: \(f(x)=\log\{(-x + min)/(x - max)\), where par=c(min, max).

  5. `glogitinv`: \(f(x)=\exp\{x\} \cdot (max + min)/(1 + \exp\{x\}) \), where par=c(min, max).

  6. `inv`: \(f(x)=\frac{1}{x}\).

  7. `pnorm`: \(f(x)=\Phi(x)\).

  8. `qnorm`: \(f(x)=\Phi^{-1}(x)\).

  9. `mexp`: \(f(x)=-\exp\{x\}\).

  10. `zeta`: \(f(x)=\log\{2 \cdot \Phi(x)\}\).

  11. `constant`: \(f(x)=c\).

  12. `chainrule_utility`: \(f(x)=f'(x)=f''(x)=f'''(x)=f''''(x)\).

  13. onemx: \(1-x\)

par

numeric vector, additional parameters, e.g. min and max for glogit.

tri

list; created by the function [trind_generator()].

deriv_order

integer; maximum order of derivative. Available are 0,2 and 4.

Details

Takes the derivs object f as an input for the function specified by type and evaluates it together with the derivatives utilizing the chainrule. For more details see [trind()] and [trind_generator()].

See Also

Other derivs: chainrule(), differencerule(), ind2joint(), list2derivs(), productrule(), quotientrule(), sumrule(), trind_generator(), trind()

Examples

Run this code
A<-matrix(c(1:9)/10, ncol=1)
A_mat<-list2derivs(list(A, A^0, A^2, A^3, A^4), deriv_order=4)
derivs_transform(f =derivs_transform(f = A, type="exp", par=0,
                                     tri=trind_generator(1), deriv_order=4),
                   type="log", par=0, tri=trind_generator(1), deriv_order=4)

Run the code above in your browser using DataLab