Learn R Programming

⚠️There's a newer version (2.0.3) of this package.Take me there.

bpnreg

The goal of bpnreg is to fit Bayesian projected normal regression models for circular data.

Installation

The R-package bpnreg can be installed from CRAN as follows:

install.packages("bpnreg")

You can install a beta-version of bpnreg from github with:

# install.packages("devtools")
devtools::install_github("joliencremers/bpnreg")

Citation

To cite the package ‘bpnreg’ in publications use:

Jolien Cremers (2020). bpnreg: Bayesian Projected Normal Regression Models for Circular Data. R package version 1.0.3. https://CRAN.R-project.org/package=bpnreg

Example

This is a basic example which shows you how to run a Bayesian projected normal regression model:

library(bpnreg)
#> Warning: package 'bpnreg' was built under R version 4.0.2
bpnr(Phaserad ~ Cond + AvAmp, Motor)
#> Projected Normal Regression 
#> 
#> Model 
#> 
#> Call: 
#> bpnr(pred.I = Phaserad ~ Cond + AvAmp, data = Motor)
#> 
#> MCMC: 
#> iterations = 1000
#> burn-in = 1
#> lag = 1
#> 
#> Model Fit: 
#>         Statistic Parameters
#> lppd    -57.02276   8.000000
#> DIC     129.91767   7.933199
#> DIC.alt 129.16896   7.558843
#> WAIC    129.92344   7.938965
#> WAIC2   131.73043   8.842460
#> 
#> 
#> Linear Coefficients 
#> 
#> Component I: 
#>                     mean        mode         sd      LB HPD     UB HPD
#> (Intercept)   1.35903284  1.31054078 0.45916211  0.51176151 2.26408763
#> Condsemi.imp -0.51431167 -0.38356351 0.65112849 -1.76181870 0.77224926
#> Condimp      -0.63880458 -0.74159122 0.66793394 -1.86754185 0.71109682
#> AvAmp        -0.01055016 -0.01139835 0.01218486 -0.03623167 0.01170322
#> 
#> Component II: 
#>                     mean        mode         sd      LB HPD      UB HPD
#> (Intercept)   1.42272991  1.27049889 0.42518913  0.59913060  2.23085396
#> Condsemi.imp -1.17555420 -1.07575082 0.58198521 -2.31181884 -0.04772718
#> Condimp      -0.97477439 -1.16513093 0.61236345 -2.16960668  0.15627423
#> AvAmp        -0.01120924 -0.01173855 0.01088949 -0.03060563  0.01049163
#> 
#> 
#> Circular Coefficients 
#> 
#> Continuous variables: 
#>    mean ax    mode ax      sd ax      LB ax      UB ax 
#>   81.92119   66.77753  106.93783 -126.42475  287.94441 
#> 
#>    mean ac    mode ac      sd ac      LB ac      UB ac 
#>  0.9607303  2.1672257  1.2672149 -0.8206028  2.4573048 
#> 
#>      mean bc      mode bc        sd bc        LB bc        UB bc 
#> -0.001954087  0.011505774  0.030594802 -0.038497492  0.025762454 
#> 
#>      mean AS      mode AS        sd AS        LB AS        UB AS 
#> -0.017532826 -0.007563145  0.309320733 -0.124976392  0.130372158 
#> 
#>    mean SAM    mode SAM      sd SAM      LB SAM      UB SAM 
#> -0.03039514 -0.00759563  0.38996867 -0.25949211  0.22435792 
#> 
#>   mean SSDO   mode SSDO     sd SSDO     LB SSSO     UB SSDO 
#> -0.07185253 -2.05247080  2.04637805 -2.81847543  2.77529945 
#> 
#> Categorical variables: 
#> 
#> Means: 
#>                           mean       mode        sd         LB       UB
#> (Intercept)          0.8133872  0.7973453 0.1984700  0.4171888 1.188380
#> Condsemi.imp         0.2843519  0.2298160 0.4338476 -0.5892295 1.117094
#> Condimp              0.5580093  0.5334042 0.4576417 -0.4067679 1.387852
#> Condsemi.impCondimp -1.2346729 -1.0865211 1.0882791  3.0123533 1.194460
#> 
#> Differences: 
#>                          mean      mode        sd         LB       UB
#> Condsemi.imp        0.5327909 0.5016397 0.5005797 -0.5136915 1.425091
#> Condimp             0.2591943 0.0723281 0.5398564 -0.7832167 1.294051
#> Condsemi.impCondimp 2.1411008 2.4533343 1.0282856 -0.4460970 3.959229

Copy Link

Version

Install

install.packages('bpnreg')

Monthly Downloads

390

Version

2.0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jolien Cremers

Last Published

March 23rd, 2021

Functions in bpnreg (2.0.1)

anyBars

anyBars function from lme4 package
RHSForm

RHSForm function from lme4 package
Maps

The geometry of human knowledge of navigation space.
Dbd

Compute utmu
RHSForm<-

RHSForm function from lme4 package
Motor

Phase differences in hand flexion-extension movements.
BFc

Bayes Factors
bpnreg

bpnreg: A package to analyze Bayesian projected normal circular regression models
expandDoubleVerts

expandDoubleVerts function from lme4 package
BFc.bpnr

Bayes Factors for a Bayesian circular regression model
cat_check

Check whether a variable is categorical
findbars

findbars function from lme4 package
BFc.bpnme

Bayes Factors for a Bayesian circular mixed-effects model
b_samp

Sample subject specific random effects
coef_circ

Circular coefficients
DIC_reg

Compute Model Fit Measures Regression Model
coef_circ.bpnme

Obtain the circular coefficients of a Bayesian circular mixed-effects model
pnme

A Gibbs sampler for a projected normal mixed-effects model
pnr

A Gibbs sampler for a projected normal regression model
sumr

Compute summary and model fit statistics for the circular regression model
circ_coef

Compute circular coefficients from linear coefficients
circ_coef_rcpp

Compute circular coefficients
coef_ran

Random effect variances
eigen_val

Compute Eigenvalues
betaBlock

Sample fixed effect coefficients
hmodeC

Estimate the mode by finding the highest posterior density interval
eigen_vec

Compute Eigenvectors
fit

Model fit
coef_lin.bpnr

Obtain the linear coefficients of a Bayesian circular regression model
coef_lin.bpnme

Obtain the linear coefficients of a Bayesian circular mixed-effects model
mean_circ

Compute the mean of a vector of circular data
hpd_est_circ

Compute the 95 percent HPD of a vector of circular data
hmodeci

Find the highest density interval.
coef_ran.bpnme

Obtain random effect variances of a Bayesian circular mixed-effects model
lik_reg

Compute the Likelihood of the PN distribution (regression)
hpd_est

Compute the 95 percent HPD of a vector of linear data
hmodeciC

Find the highest density interval of a circular variable
isAnyArgBar

isAnyArgBar function from lme4 package
bpnme

Fit a Bayesian circular mixed-effects model
fit.bpnme

Model fit for a Bayesian circular mixed-effects model
mode_est

Compute the mode of a vector of linear data
theta_bar

Compute a mean direction
fit.bpnr

Model fit for a Bayesian circular regression model
coef_circ.bpnr

Obtain the circular coefficients of a Bayesian circular regression model
mmme

Create model matrices for a circular mixed-effects regression model
coef_lin

Linear coefficients
bpnr

Fit a Bayesian circular regression model
hmode

Estimate the mode by finding the highest posterior density interval
mmr

Create model matrices circular regression
isBar

isBars function from lme4 package
mode_est_circ

Compute the mode of a vector of circular data
reOnly

reOnly function from lme4 package
mvrnorm_arma_eigen

Sample from a multivariate normal distribution
safeDeparse

reOnly function from lme4 package
traceplot.bpnr

Traceplots for a Bayesian circular regression model
rho_circ

Compute the mean resultant length of a vector of circular data
traceplot

Traceplots
rho

Compute a mean resultant length
lik_me

Compute the Likelihood of the PN distribution (mixed effects)
nobars_

nobars_ function from lme4 package
print.bpnme

Print output from a Bayesian circular mixed-effects model
traceplot.bpnme

Traceplots for a Bayesian circular mixed-effects model
nobars

nobars function from lme4 package
print.bpnr

Print output from a Bayesian circular regression model
sd_circ

Compute the standard deviation of a vector of circular data
omega_samp

Sample precision matrix
subbars

subbars function from lme4 package
summe

Compute summary and model fit statistics for the circular mixed-effects regression model
slice_rcpp

A slice sampler for the latent lengths r