Description Usage Arguments Value Author(s) References See Also Examples

Fit an additive model where each component is estimated to piecewise constant with a small number of adaptively-chosen knots. The model is fit for a sequence of tuning parameters. In particular, this function implements the "fused lasso additive model", as proposed in Petersen, A., Witten, D., and Simon, N. (2014). Fused Lasso Additive Model. arXiv preprint arXiv:1409.5391.

1 2 |

`x` |
n x p covariate matrix. May have p > n. |

`y` |
n-vector containing the outcomes for the n observations in |

`lambda.min.ratio` |
smallest value for |

`n.lambda` |
the number of lambda values to consider - the default is 50. |

`lambda.seq` |
a user-supplied sequence of positive lambda values to consider. The typical usage is to calculate |

`alpha.seq` |
the value(s) of alpha to consider - default is 1. Values must be in [0,1] with values near 0 prioritizing sparsity of functions and values near 1 prioritizing limiting the number of knots. Empirical evidence suggests using alpha of 1 when p < n and alpha of 0.75 when p > n. Note that the model is fit for all combinations of |

`family` |
specifies the loss function to use. Currently supports squared error loss (default; |

`method` |
specifies the optimization algorithm to use. Options are block-coordinate descent (default; |

`tolerance` |
specifies the convergence criterion for the objective (default is 10e-6). |

An object with S3 class "flam".

`all.alpha` |
vector of alpha values considered. This will be m times longer than the user-specified |

`all.lambda` |
vector of lambda values considered. This will be q times longer than the user-specified |

`theta.hat.list` |
list of estimated theta matrices of dimension n x p. Note that the predicted values |

`f.hat.list` |
list of estimated function matrices of dimension n x p. Note that |

`beta0.hat.vec` |
vector of estimated intercepts with |

`y.hat.mat` |
matrix with |

`non.sparse.list` |
list with |

`num.non.sparse` |
vector with |

`y` |
as specified by user. |

`x` |
as specified by user. |

`family` |
as specified by user (or default). |

`method` |
as specified by user (or default). |

`tolerance` |
as specified by user (or default). |

`call` |
the matched call. |

Ashley Petersen

Petersen, A., Witten, D., and Simon, N. (2014). Fused Lasso Additive Model. arXiv preprint arXiv:1409.5391.

`predict.flam`

, `plot.flam`

, `summary.flam`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
#See ?'flam-package' for a full example of how to use this package
#generate data
set.seed(1)
data <- sim.data(n = 50, scenario = 1, zerof = 10, noise = 1)
#fit model for a range of lambda chosen by default and alpha's of 0.75 and 1
flam.out <- flam(x = data$x, y = data$y, alpha.seq = c(0.75, 1))
#or specify desired lambda sequence (often equally spaced on log scale)
#should be a decreasing sequence of several values for computational speed
user.lambda.seq <- exp(seq(log(50), log(1), len=40))
flam.out2 <- flam(x = data$x, y = data$y, lambda.seq = user.lambda.seq)
## Not run:
#alternatively, generate data for logistic FLAM model
data2 <- sim.data(n = 50, scenario = 1, zerof = 10, family = "binomial")
#fit the FLAM model using logistic loss
flam.logistic.out <- flam(x = data2$x, y = data2$y, family = "binomial")
## End(Not run)
#'flam' returns an object of the class 'flam'
#see ?'flam-package' for an example using S3 methods for 'flam' objects
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.