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

You can install bpnreg from github with:

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

Example

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

library(bpnreg)
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    -56.98665   8.000000
#> DIC     130.03264   7.978867
#> DIC.alt 129.00526   7.465178
#> WAIC    130.13423   8.080461
#> WAIC2   131.93160   8.979148
#> 
#> 
#> Linear Coefficients 
#> 
#> Component I: 
#>                     mean         mode         sd      LB HPD     UB HPD
#> (Intercept)   1.38838877  1.430450408 0.44851825  0.54791575 2.21283384
#> Condsemi.imp -0.55387711 -0.586686873 0.61704234 -1.66603600 0.62531778
#> Condimp      -0.64634612 -0.671047696 0.67977534 -1.86378099 0.74237047
#> AvAmp        -0.01081638 -0.007612952 0.01192791 -0.03374693 0.01254156
#> 
#> Component II: 
#>                     mean        mode         sd      LB HPD      UB HPD
#> (Intercept)   1.43186794  1.34887463 0.42859821  0.61193193  2.26798239
#> Condsemi.imp -1.21413507 -1.31468438 0.58965151 -2.29088651 -0.01454310
#> Condimp      -0.97439306 -1.21569705 0.63152408 -2.20567414  0.22262240
#> AvAmp        -0.01174821 -0.01165855 0.01121201 -0.03183777  0.01192664
#> 
#> 
#> Circular Coefficients 
#> 
#> Continuous variables: 
#>    mean ax    mode ax      sd ax      LB ax      UB ax 
#>   91.20303   70.15309  131.17655 -104.32763  313.05562 
#> 
#>    mean ac    mode ac      sd ac      LB ac      UB ac 
#>  0.8709000  2.0828734  1.3282028 -0.8151373  2.5196304 
#> 
#>      mean bc      mode bc        sd bc        LB bc        UB bc 
#> -0.004133268  0.009906482  0.037287197 -0.035000622  0.025243901 
#> 
#>      mean AS      mode AS        sd AS        LB AS        UB AS 
#> -0.015613031 -0.006036166  0.323371494 -0.205164040  0.106346969 
#> 
#>     mean SAM     mode SAM       sd SAM       LB SAM       UB SAM 
#>  0.120674972 -0.008383957  3.571831737 -0.192199588  0.240442932 
#> 
#>   mean SSDO   mode SSDO     sd SSDO     LB SSSO     UB SSDO 
#>  0.02983466 -2.03153425  2.07108578 -2.76494006  2.78617593 
#> 
#> Categorical variables: 
#> 
#> Means: 
#>                           mean       mode        sd         LB       UB
#> (Intercept)          0.8036304  0.7090624 0.1980157  0.4295190 1.180707
#> Condsemi.imp         0.2449676  0.3431420 0.4128835 -0.5628898 1.077003
#> Condimp              0.5505015  0.6278918 0.4600773 -0.4725950 1.344139
#> Condsemi.impCondimp -1.2906544 -1.6598716 1.0721323  3.0402344 1.082592
#> 
#> Differences: 
#>                          mean       mode        sd         LB       UB
#> Condsemi.imp        0.5601076 0.50581982 0.4810523 -0.3500191 1.504551
#> Condimp             0.2564314 0.09884444 0.5388666 -0.8239476 1.297076
#> Condsemi.impCondimp 2.1797273 2.58905512 1.0137416 -0.4643209 3.889132

Copy Link

Version

Install

install.packages('bpnreg')

Monthly Downloads

296

Version

1.0.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jolien Cremers

Last Published

February 4th, 2020

Functions in bpnreg (1.0.3)

Motor

Phase differences in hand flexion-extension movements.
circ_coef

Compute circular coefficients from linear coefficients
coef_lin

Linear coefficients
cat_check

Check whether a variable is categorical
fit.bpnme

Model fit for a Bayesian circular mixed-effects model
fit

Model fit
bpnreg

bpnreg: A package to analyze Bayesian projected normal circular regression models
coef_circ.bpnr

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

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

Compute circular coefficients
b.f

Sample subject specific random effects
betaBlock.fRI

Sample fixed effect coefficients in a Random Intercept model
coef_lin.bpnr

Obtain the linear coefficients of a Bayesian circular regression model
hmodeciC

Find the highest density interval of a circular variable
coef_circ.bpnme

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

Circular coefficients
anyBars

anyBars function from lme4 package
hpd_est

Compute the 95 percent HPD of a vector of linear data
fit.bpnr

Model fit for a Bayesian circular regression model
betaBlock.fRS

Sample fixed effect coefficients in a Random Slope model
mmr

Create model matrices circular regression
eigen_val

Compute Eigenvalues
mode_est

Compute the mode of a vector of linear data
lik

Compute the Likelihood of the PN distribution
isBar

isBars function from lme4 package
Omega.f

Sample precision matrix
hmode

Estimate the mode by finding the highest posterior density interval
mvrnorm_arma_eigen

Sample from a multivariate normal distribution
pnr

A Gibbs sampler for a projected normal regression model
residuals.bpnme

Residuals for a Bayesian circular mixed-effects model
nobars

nobars function from lme4 package
mode_est_circ

Compute the mode of a vector of circular data
eigen_vec

Compute Eigenvectors
expandDoubleVerts

expandDoubleVerts function from lme4 package
predict.bpnme

Predicted values for a Bayesian circular mixed-effects model
findbars

findbars function from lme4 package
nobars_

nobars_ function from lme4 package
residuals.bpnr

Residuals for a Bayesian circular regression model
sumr

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

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

isAnyArgBar function from lme4 package
print.bpnr

Print output from a Bayesian circular regression model
slice_rcpp

A slice sampler for the latent lengths r
slice_r_me

Sample R (latent lengths)
theta_bar

Compute a mean direction
traceplot.bpnr

Traceplots for a Bayesian circular regression model
subbars

subbars function from lme4 package
reOnly

reOnly function from lme4 package
summe

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

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

Compute a mean resultant length
bpnme

Fit a Bayesian circular mixed-effects model
hmodeC

Estimate the mode by finding the highest posterior density interval
coef_ran

Random effect variances
hmodeci

Find the highest density interval.
bpnr

Fit a Bayesian circular regression model
coef_ran.bpnme

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

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

Compute the mean of a vector of circular data
print.bpnme

Print output from a Bayesian circular mixed-effects model
predict.bpnr

Predicted values for a Bayesian circular regression model
safeDeparse

reOnly function from lme4 package
sd_circ

Compute the standard deviation of a vector of circular data
traceplot

Traceplots
traceplot.bpnme

Traceplots for a Bayesian circular mixed-effects model
Dbd

Compute utmu
BFc

Bayes Factors
BFc.bpnme

Bayes Factors for a Bayesian circular mixed-effects model
DIC_reg

Compute Model Fit Measures Regression Model
BFc.bpnr

Bayes Factors for a Bayesian circular regression model
Maps

The geometry of human knowledge of navigation space.
RHSForm<-

RHSForm function from lme4 package
RHSForm

RHSForm function from lme4 package