1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<!-- README.md is generated from README.Rmd. Please edit that file -->
# fRegression
[](https://ci.appveyor.com/project/paulnorthrop/fRegression)
[](https://github.com/paulnorthrop/fRegression/actions)
[](https://codecov.io/github/paulnorthrop/fRegression?branch=main)
[](https://cran.r-project.org/package=fRegression)
[](https://cran.r-project.org/package=fRegression)
[](https://cran.r-project.org/package=fRegression)
## Rmetrics - Modelling Extreme Events in Finance
The **fRegression** package is a collection of functions for linear and
non-linear regression modelling. It implements a wrapper for several
regression models available in the base and contributed packages of R.
### An example
The following code simulates some regression data and fits various
models to these data.
``` r
library(fRegression)
# Simulate data: the response is linearly related to 3 explanatory variables
x <- regSim(model = "LM3", n = 100)
# Linear modelling
regFit(Y ~ X1 + X2 + X3, data = x, use = "lm")
#>
#> Title:
#> Linear Regression Modeling
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> (Intercept) X1 X2 X3
#> 0.01578 0.73967 0.25128 -0.50611
# Robust linear modelling
regFit(Y ~ X1 + X2 + X3, data = x, use = "rlm")
#>
#> Title:
#> Robust Linear Regression Modeling
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> (Intercept) X1 X2 X3
#> 0.01968 0.74264 0.24736 -0.50123
# Generalised additive modelling
regFit(Y ~ X1 + X2 + X3, data = x, use = "gam")
#>
#> Title:
#> Generalized Additive Modeling
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> (Intercept) X1 X2 X3
#> 0.01578 0.73967 0.25128 -0.50611
# Projection pursuit modelling
regFit(Y ~ X1 + X2 + X3, data = x, use = "ppr")
#>
#> Title:
#> Projection Pursuit Regression
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> -- Projection Direction Vectors --
#> term 1 term 2
#> X1 0.7950116 -0.4422500
#> X2 0.2733278 -0.4863312
#> X3 -0.5415242 -0.7535894
#> -- Coefficients of Ridge Terms --
#> term 1 term 2
#> 0.9163087 0.0439332
# Feed-forward neural network modelling
regFit(Y ~ X1 + X2 + X3, data = x, use = "nnet")
#>
#> Title:
#> Feedforward Neural Network Modeling
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> a 3-2-1 network with 11 weights
#> options were - linear output units
#> [1] 3.3664690 0.5597762 0.2646774 -0.5300914 0.8276914 -0.4493467
#> [7] -0.1400424 0.2787105 -0.5420174 5.4429808 -6.7838054
# Polychotonous Multivariate Adaptive Regression Splines
regFit(Y ~ X1 + X2 + X3, data = x, use = "polymars")
#> 1 2 3 4 5 6
#> 0.9145273 1.1607611 1.0482997 -0.5673597 -0.4692621 -1.3336450
#> X1 X2 X3
#> 1 1.8197351 -0.39077723 0.24075985
#> 2 1.3704395 0.39665330 -0.02049151
#> 3 1.1963182 0.78156956 0.29685497
#> 4 -0.4068792 -0.01912605 0.55061347
#> 5 -0.6109788 -1.94431293 -0.71396821
#> 6 -1.5089120 -0.24550669 0.38003407
#>
#> Title:
#> Polytochomous MARS Modeling
#>
#> Formula:
#> Y ~ X1 + X2 + X3
#>
#> Family:
#> gaussian identity
#>
#> Model Parameters:
#> pred1 knot1 pred2 knot2 coefs SE
#> 1 0 NA 0 NA 0.01577838 0.009803798
#> 2 1 NA 0 NA 0.73967249 0.009930477
#> 3 3 NA 0 NA -0.50611270 0.010729997
#> 4 2 NA 0 NA 0.25127670 0.010419817
```
### Installation
To get the current released version from CRAN:
``` r
install.packages("fRegression")
```
|