# Morse Smale Complex Linear Regression

### Description

Piecewise linear regression on the decomposition of the domain based on the
partion induced by the Morse-Smale complex. For `msc.elnet`

an elastic net is
fitted insetad of a simple lienar regression.

For prediction the linear model are either avergaed based on weighting the
contributions from each partition for a predicting point or predicted based on
the linear model corresponding to the highest partition probability. The
weights for each partition are computed depending on the underlying Morse-Smale
complex type (see `msc.nn`

). The functions can be called with
`msc.nn`

without predictive capacities, then prediction of unseen
data is not supported.

### Usage

1 2 |

### Arguments

`ms` |
A Morse-Smale complex object, see |

.

`nfold` |
Number of folds for crossvlaidation, used for selecting an appropriate persitence level if the underlying Morse-Smale complex objects has multiple levels. |

`modelSelect` |
Do a forward stepwise model selection for each linear model (for each parttion ther eis on linear model) |

`blend` |
Use blending for model preidtcion. FALSE results in pecewise linear model. |

`verbose` |
Print model fitting information |

### Value

An object of class `c("msc.lm")`

or `c("msc.elnet")`

, that can be used for prediction with
`predict`

.

The object `c("msc.lm")`

has the following components:

`ms` |
The Morse-Smale complex, see |

`lms` |
The linear models and crossvalidation results for each level in ms. |

`blend` |
Use blending for model prediction. |

The object `c("msc.elnet")`

has the following components:

`ms` |
The Morse-Smale complex, see |

`elnet` |
The elastic net models and crossvalidation results for each level in ms. |

### Author(s)

Samuel Gerber

### References

[1] Samuel Gerber and Kristin Potter The Morse-Smale Complex for Data Analysis, Journal of Statistical Software, 2012, vol. 50, no. 2, pp 1-22

[2] Samuel Gerber, Oliver Ruebel Peer-Timo Bremer, Valerio Pascucci, Ross Whitaker, Morse-Smale Regression, Journal of Computational and Graphical Statistics, 2012

[3] Samuel Gerber, Peer-Timo Bremer, Valerio Pascucci, Ross Whitaker, Visual Exploration of High Dimensional Scalar Functions, IEEE Transactions on Visualization and Computer Graphics, vol. 16, no. 6, pp 1271-1280, Nov.-Dec. 2010.

### See Also

`msc.nn`

,
`predict.msc.lm`

,
`glmnet`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
#create Morse-Smale complex regression of fourpeaks2d data set
data(fourpeaks)
d <- fourpeaks()
#build Morse-Smale complex
ms <- msc.nn.svm(y=d[,1], x=d[, 2:3], pLevel=0.1, knn = 10)
msr <- msc.lm(ms)
#show slected persitence level by cross validtaion
msr$ms$predictLevel
#print mean squared crossvalidated error
msr$lms[[msr$ms$predictLevel]]$cv
#predict
fp <- predict(msr, d[, 2:3])
#fit an elastic model insteaed
msr <- msc.elnet(ms)
#prediction for ealstic model
fp <- predict(msr, d[, 2:3])
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.