vbvs.concurrent
vbvs.concurrent: Fitting Methods for the Functional Linear Concurrent Model - Published in JOSS (2016)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Engineering
Computer Science -
60% confidence
Last synced: 6 months ago
·
JSON representation
Repository
Basic Info
Statistics
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 1
- Releases: 0
Created over 10 years ago
· Last pushed over 6 years ago
Metadata Files
Readme
License
README.Rmd
---
output:
github_document
---
## vbvs.concurrent: Fitting Methods for the Functional Linear Concurrent Model
[](https://travis-ci.org/jeff-goldsmith/vbvs.concurrent)
[](https://codecov.io/gh/jeff-goldsmith/vbvs.concurrent?branch=master)
[](http://joss.theoj.org/papers/a3884174f17dbb9a695f7b8658887eff)
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = '#>',
collapse = TRUE,
warning = FALSE,
message = FALSE,
eval = TRUE,
cache = FALSE
)
```
Author: Jeff Goldsmith
License: [GPL-3](https://opensource.org/licenses/GPL-3.0)
Version: 0.1
---------------
Functional data analysis is concerned with understanding measurements made over time, space, frequencies, and other domains for multiple subjects. Given the ubiquity of wearable devices, it is common to obtain several data streams monitoring blood pressure, physical activity, heart rate, location, and other quantities on study participants in parallel. Each of these data streams can be thought of as functional data, and the functional linear concurrent model is useful for relating predictor data to an outcome.
This package implements two statistical methods (with and without variable selection) for estimating the parameters in the functional linear concurrent model; these methods are described in detail [here](http://jeffgoldsmith.com/Downloads/VBVS.pdf). Additional functions to create predictions based on parameter estimates, to extract model coefficients, and to choose tuning parameters via cross validation are included. Interactive visualizations are supported through the [refund.shiny](https://github.com/refunders/refund.shiny) package.
### Installation
---------------
You can install the latest version directly from GitHub with [devtools](https://github.com/hadley/devtools):
```{r, results='hide', eval=FALSE}
install.packages("devtools")
devtools::install_github("jeff-goldsmith/vbvs.concurrent")
```
Interactive plotting is implemented through [refund.shiny](https://github.com/refunders/refund.shiny), which can be installed from CRAN or GitHub.
### Example of use
---------------
The code below simulates a dataset under the functional linear concurrent model. For each of 50 subjects, observations of two predictor functions and a response function are observed over times between 0 and 1. The predictors and the coefficients that relate them to the response vary over time.
```{r simulate_data}
library(tidyverse)
## set design elements
set.seed(1)
I = 50
p = 2
## coefficient functions
beta1 = function(t) { 1 }
beta2 = function(t) { cos(2*t*pi) }
## generate subjects and observation times
concurrent.data =
data.frame(
subj = rep(1:I, each = 20)
) %>%
mutate(time = runif(dim(.)[1])) %>%
arrange(subj, time) %>%
group_by(subj) %>%
mutate(Cov_1 = runif(1, .5, 1.5) * sin(2 * pi * time),
Cov_2 = runif(1, 0, 1) + runif(1, -.5, 2) * time,
Y = Cov_1 * beta1(time) +
Cov_2 * beta2(time) +
rnorm(20, 0, .5)) %>%
ungroup()
```
The plot below shows the predictors and the response, highlighting four subjects.
```{r plot_data, fig.align='center', fig.height=3, fig.width=9, echo=FALSE}
library(gridExtra)
plot_function = function(value_var, data) {
ggplot(data, aes_string(x = "time", y = value_var, group = "subj")) + geom_path(alpha = .1) +
theme_bw() +
geom_path(data = filter(data, subj %in% 1:4) %>% mutate(subj = as.factor(subj)), aes(color = subj)) +
theme(legend.position = "none")
}
panels = lapply(c("Cov_1", "Cov_2", "Y"), plot_function, data = concurrent.data)
grid.arrange(panels[[1]], panels[[2]], panels[[3]], nrow = 1)
```
To fit the functional linear concurrent model, we can use `vb_concurrent`. Alternatively, we can use `vbvs_concurrent` which is similar but adds variable selection to the estimation approach.
```{r fit}
library(vbvs.concurrent)
fit_vb = vb_concurrent(Y ~ Cov_1 + Cov_2 | time, id.var = "subj", data = concurrent.data,
t.min = 0, t.max = 1, standardized = TRUE)
fit_vbvs = vbvs_concurrent(Y ~ Cov_1 + Cov_2 | time, id.var = "subj", data = concurrent.data,
t.min = 0, t.max = 1, standardized = TRUE)
```
The plot below shows true coefficients and estimates without using variable selection.
```{r coefficients, echo=FALSE, fig.height=3, fig.width=9, echo=FALSE}
coefs = coef(fit_vb, t.new = seq(0, 1, length = 101)) %>%
mutate(True_1 = beta1(time),
True_2 = beta2(time)) %>%
gather(key, value, Cov_1:True_2) %>%
extract(key, c("Estimate", "Beta"), "([[:alnum:]]+)_([[:alnum:]]+)")
ggplot(coefs, aes(x = time, y = value, color = Estimate)) + geom_path() +
facet_wrap(~Beta) + theme_bw()
```
Interactive graphics show observed data, coefficient functions, and residual curves. The code below will produce such a graphic.
```{r interactive_plot, eval=FALSE}
library(refund.shiny)
plot_shiny(fit_vb)
plot_shiny(fit_vbvs)
```
### Contributions
---------------
If you find small bugs, larger issues, or have suggestions, please file them using the [issue tracker](https://github.com/jeff-goldsmith/vbvs.concurrent/issues) or email the maintainer at . Contributions (via pull requests or otherwise) are welcome.
Owner
- Name: Jeff Goldsmith
- Login: jeff-goldsmith
- Kind: user
- Location: New York
- Company: Columbia University
- Website: jeffgoldsmith.com
- Repositories: 4
- Profile: https://github.com/jeff-goldsmith
JOSS Publication
vbvs.concurrent: Fitting Methods for the Functional Linear Concurrent Model
Published
December 20, 2016
Volume 1, Issue 8, Page 141
Tags
statistical analysisGitHub Events
Total
Last Year
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jeff Goldsmith | j****h@c****u | 22 |
| Arfon Smith | a****n | 1 |
Committer Domains (Top 20 + Academic)
columbia.edu: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 4 hours
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rotalorenzo (1)
Pull Request Authors
- arfon (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- FNN * imports
- dplyr * imports
- splines * imports
- stats * imports
- testthat * suggests
