SMFilter
an R package implementing the filtering algorithms for the state-space models on the Stiefel manifold
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: mdpi.com -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Keywords
Repository
an R package implementing the filtering algorithms for the state-space models on the Stiefel manifold
Basic Info
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
SMFilter version 1.0.4 (Red Filter)
The package implements the filtering algorithms for the state-space models on the Stiefel manifold. It also implements sampling algorithms for uniform, vector Langevin-Bingham and matrix Langevin-Bingham distributions on the Stiefel manifold. You can also find the package on CRAN, see
and the corresponding paper
State-Space Models on the Stiefel Manifold with a New Approach to Nonlinear Filtering
How to install
You can either install the stable version from CRAN
r
install.packages("SMFilter")
or install the development version from GitHub
r
devtools::install_github("yukai-yang/SMFilter")
provided that the package "devtools" has been installed beforehand.
Example
After installing the package, you need to load (attach better say) it by running the code
r
library(SMFilter)
You can first check the information and the current version number by running
``` r version()
> SMFilter version 1.0.3 (Red Filter)
```
Then you can take a look at all the available functions and data in the package
``` r ls( grep("SMFilter", search()) )
> [1] "FDist2" "FilterModel1" "FilterModel2" "rmLB_sm"
> [5] "runifsm" "rvlbsm" "SimModel1" "SimModel2"
> [9] "version"
```
Type one model
For details, see
r
?SimModel1
First we can use the package to sample from the type one model. To this end, we shall initialize by running
r
set.seed(1) # control the seed
iT = 100 # sample size
ip = 2 # dimension of the dependent variable
ir = 1 # rank number
iqx = 3 # dimension of the independent variable x_t
iqz=0 # dimension of the independent variable z_t
ik = 0 # lag length
method='max_3' # the optimization methond to use, for details, see FilterModel1
Omega = diag(ip)*.1 # covariance of the errors
vD = 50 # diagonal of the D matrix
Then we initialize the data and some other parameters
r
if(iqx==0) mX=NULL else mX = matrix(rnorm(iT*iqx),iT, iqx)
if(iqz==0) mZ=NULL else mZ = matrix(rnorm(iT*iqz),iT, iqz)
if(ik==0) mY=NULL else mY = matrix(0, ik, ip)
alpha_0 = matrix(c(runif_sm(num=1,ip=ip,ir=ir)), ip, ir)
beta = matrix(c(runif_sm(num=1,ip=ip*ik+iqx,ir=ir)), ip*ik+iqx, ir)
if(ip*ik+iqz==0) mB=NULL else mB = matrix(c(runif_sm(num=1,ip=(ip*ik+iqz)*ip,ir=1)), ip, ip*ik+iqz)
Then we can simulate from the model
r
ret = SimModel1(iT=iT, mX=mX, mZ=mZ, mY=mY, alpha_0=alpha_0, beta=beta, mB=mB, vD=vD, Omega=Omega)
Have a look at the simulated data
r
matplot(ret$dData[,1:ip], type="l", ylab="simulated data")

Then let's apply the filtering algorithm on the data
r
fil = FilterModel1(mY=as.matrix(ret$dData[,1:ip]), mX=mX, mZ=mZ, beta=beta, mB=mB, Omega=Omega, vD=vD, U0=alpha_0, method=method)
Then we compare the filtered modal orientations with the true ones in terms of the squared Frobenius norm distance (normalized).

What if we start with a wrongly specified initial value, −α0 cannot be worse?

Type two model
For details, see
r
?SimModel2
Again, we start with sampling. We initialize the parameters
r
iT = 100
ip = 2
ir = 1
iqx = 4
iqz=0
ik = 0
Omega = diag(ip)*.1
vD = 50
Then we initialize the data and some other parameters
r
if(iqx==0) mX=NULL else mX = matrix(rnorm(iT*iqx),iT, iqx)
if(iqz==0) mZ=NULL else mZ = matrix(rnorm(iT*iqz),iT, iqz)
if(ik==0) mY=NULL else mY = matrix(0, ik, ip)
alpha = matrix(c(runif_sm(num=1,ip=ip,ir=ir)), ip, ir)
beta_0 = matrix(c(runif_sm(num=1,ip=ip*ik+iqx,ir=ir)), ip*ik+iqx, ir)
if(ip*ik+iqz==0) mB=NULL else mB = matrix(c(runif_sm(num=1,ip=(ip*ik+iqz)*ip,ir=1)), ip, ip*ik+iqz)
Then we can simulate from the model
r
ret = SimModel2(iT=iT, mX=mX, mZ=mZ, mY=mY, alpha=alpha, beta_0=beta_0, mB=mB, vD=vD)
And then have a look at the simulated data
r
matplot(ret$dData[,1:ip], type="l",ylab="simulated data")

Apply the filtering algorithm on the data
r
fil = FilterModel2(mY=as.matrix(ret$dData[,1:ip]), mX=mX, mZ=mZ, alpha=alpha, mB=mB, Omega=Omega, vD=vD, U0=beta_0, method=method)
Then we compare the filtered modal orientations with the true ones in terms of the squared Frobenius norm distance (normalized).

What if we start with a wrongly specified initial value, −β0 cannot be worse?

Owner
- Name: 凱(Kai)
- Login: yukai-yang
- Kind: user
- Location: Uppsala, Sverige
- Company: Statistiska Inst., Uppsala Universitet
- Website: yukai-yang.github.io/
- Repositories: 6
- Profile: https://github.com/yukai-yang
臨 兵 闘 者 皆 陣 烈 在 前
GitHub Events
Total
- Delete event: 1
- Push event: 2
Last Year
- Delete event: 1
- Push event: 2
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 38
- Total Committers: 1
- Avg Commits per committer: 38.0
- Development Distribution Score (DDS): 0.0
Top Committers
| Name | Commits | |
|---|---|---|
| 凱(Kai) | y****g@g****m | 38 |
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total 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
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
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 218 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: SMFilter
Filtering Algorithms for the State Space Models on the Stiefel Manifold
- Homepage: https://github.com/yukai-yang/SMFilter
- Documentation: http://cran.r-project.org/web/packages/SMFilter/SMFilter.pdf
- License: GPL-3
-
Latest release: 1.0.3
published about 7 years ago
Rankings
Maintainers (1)
Dependencies
- R >= 3.0.0 depends
- ggplot2 * suggests
- knitr * suggests
- rmarkdown * suggests