bpnme: Fit a Bayesian circular mixed-effects model

Description Usage Arguments Details Value Source Examples

View source: R/regression.R

Description

This function fits a Bayesian circular mixed-effects model based on the projected normal distribution.

Usage

1
2
bpnme(pred.I, data, pred.II = pred.I, its = 1000, burn = 1, n.lag = 1,
  seed = NULL)

Arguments

pred.I

model equation for effects of component 1.

data

the dataframe used for analysis.

pred.II

model equation for effects of component 2.

its

output iterations of the MCMC sampler.

burn

number of burn-in iterations.

n.lag

amount of lag for the iterations and burn-in.

seed

user-specified random seed.

Details

Because the model is based on the projected normal distribution, a model equation has to be given for the fixed and random effects of the two components. By default the model equation of the second component pred.II is set to be equal to that of the first component. For more information about the projected normal distribution see Presnell, Morrisson & Littell (1998).

A tutorial on how to use this function can be found in Cremers & Klugkist (2017, working paper). More details on the sampling algorithm and interpretation of the coefficients from the model can be found in Nu<c3><b1>ez-Antonio & Gutti<c3><a9>rrez-Pe<c3><b1>a (2014) and Cremers & Klugkist (2017, working paper).

Value

A bpnme object, which can be further analyzed using the associated functions traceplot.bpnme, BFc.bpnme, coef_lin.bpnme, coef_circ.bpnme, coef_ran.bpnme, residuals.bpnme, predict.bpnme, fit.bpnme and print.bpnme.

A bpnr object contains the following elements (some elements are not returned if not applicable)

Beta.I

A matrix of posterior samples for the fixed effects coefficients for the first component.

Beta.II

A matrix of posterior samples for the fixed effects coefficients for the second component.

B.I

An array of posterior samples for the random effects coefficients for the first component.

B.II

An array of posterior samples for the random effects coefficients for the second component.

VCovI

An array of posterior samples for the random effect variances of the first component.

VCovII

An array of posterior samples for the random effect variances of the second component.

predictiva

A list containing the posterior density values for all timepoints of individuals in the dataset for all iterations. The rowsums of this matrix are the likelihood values for all iterations

circular.ri

A vector of posterior samples for the circular random intercepts.

N

Number of observed cases.

its

Number of output iterations.

n.lag

One in n.lag iterations will be saved as output iteration. Set lag to 1 to save all iterations (default).

burn

Burn-in time for the MCMC sampler.

p1

Number of fixed effect parameters predicting the first component.

p2

Number of fixed effect parameters predicting the second component.

q1

Number of random effect parameters predicting the first component.

q2

Number of random effect parameters predicting the second component.

a.x

A matrix of posterior samples for a.x which describes the location of the inflection point of the regression curve on the axis of the predictor.

a.c

A matrix of posterior samples for a.c which describes the location of the inflection point of the regression curve on the axis of the circular outcome.

b.c

A matrix of posterior samples for b.c which describes the slope of the tangent line at the inflection point.

SAM

A matrix of posterior samples for the circular regression slopes at the mean.

AS

A matrix of posterior samples for the average slopes of the circular regression.

SSDO

A matrix of posterior samples for the signed shortest distance to the origin.

circ.diff

A matrix of posterior samples for the circular difference found between levels of categorical variables and the intercept.

cRSnum

A string indicating whether there are continuous variables with a random slope

cRScat

A string indicating whether there are categorical variables with a random slope

cRS

A string indicating whether there are categorical or continuous variables with a random slope

cRI

A vector of posterior samples of the mean resultant length of the circular random intercept, a measure of concentration.

Call

The matched call.

lin.coef.I

The mean, mode, standard deviation and 95 posterior density of the linear fixed effect coefficients for B1.

lin.coef.II

The mean, mode, standard deviation and 95 confidence interval of the highest posterior density of the linear fixed effect coefficients for B2.

circ.coef

The mean, mode, standard deviation and 95 density for a.x, a.c, SSDO, and the circular fixed effect coefficients b.c, AS, and SAM

circ.coef.cat

The mean, mode, standard deviation and 95 confidence interval of the highest posterior density the circular difference between levels of categorical variables and the intercept.

circ.coef.means

The mean, mode, standard deviation and 95 confidence interval of the highest posterior density of circular means of the categorical variables.

model.fit

A list of information criteria for assessment of model fit.

lin.res.varrand.I

The mean, mode, standard deviation and 95 variances of the random intercepts and slopes of component I.

lin.res.varrand.II

The mean, mode, standard deviation and 95 of component II.

circ.res.varrand

The mean, mode, standard deviation and 95 random intercepts and slopes.

mm

A list of information, model matrices, sample size, etc. on the specified model.

Source

Cremers, J., Mainhard, M.T. & Klugkist, I. (in press). Assessing a Bayesian Embedding Approach to Circular Regression Models. Methodology

Cremers, J., & Klugkist, I. (2017). How to analyze circular data: A tutorial for projected normal regression models. Under review.

Cremers, J., & Klugkist, I. (2017). Longitudinal circular modelling of circumplex measurements for teacher behavior. Working paper.

Nu<c3><b1>ez-Antonio, G. & Guti<c3><a9>rrez-Pe<c3><b1>a, E. (2014). A Bayesian model for longitudinal circular data based on the projected normal distribution. Computational Statistics and Data Analysis, 71, 506-519.

Presnell, B., Morrison, S.P. & Littell, R.C. (1998). Projected multivariate linear models for directional data. Journal of the American Statistical Association, 93 (443), 1068 - 1077.

Examples

1
2
library(bpnreg)
bpnme(Error.rad ~ Maze + Trial.type + (1|Subject), Maps, its = 100)

bpnreg documentation built on May 2, 2019, 6:37 a.m.