bpnr {bpnreg} | R Documentation |
Fit a Bayesian circular regression model
Description
This function fits a Bayesian circular regression model based on the projected normal distribution.
Usage
bpnr(
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 two components. By default the equation
of the second component pred.II
is set to be equal to that of the
first component. Note that the circular outcome needs to be measured in
radians on a scale from 0 to 2\pi
. 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 (2018). More details on the sampling algorithm and interpretation of the coefficients from the model can be found in Cremers, Mulder & Klugkist (2018) and Cremers, Mainhard & Klugkist (2018). The uninformative priors for the regression coefficients of the two components are set to N(0, 10000).
Value
A bpnr
object, which can be further analyzed using the
associated functions traceplot.bpnr
, BFc.bpnr
,
coef_lin.bpnr
, coef_circ.bpnr
,
fit.bpnr
and print.bpnr
.
A bpnr
object contains the following elements (some elements are not
returned if not applicable)
beta1
A matrix of posterior samples for the coefficients
beta1
of the first component.beta2
A matrix of posterior samples for the coefficients
beta2
for the second component.Likelihood
A matrix containing the posterior density values for all individuals in the dataset for all iterations. The rowsums of this matrix are the likelihood values for all iterations
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-in
Burn-in time for the MCMC sampler.
p1
Number of parameters predicting the first component.
p2
Number of parameters predicting the second component.
theta
The circular outcome vector measured in radians.
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 between levels of categorical variables and the intercept.
Call
The matched call.
lin.coef.I
The mean, mode, standard deviation and 95 confidence interval of the highest posterior density of the linear coefficients for
beta1
.lin.coef.II
The mean, mode, standard deviation and 95 density of the linear coefficients for
beta2
.circ.coef
The mean, mode, standard deviation and 95 confidence interval of the highest posterior density for the
a.x
,a.c
,b.c
,AS
,SAM
andSSDO
of the circular coefficients.circ.coef.cat
The mean, mode, standard deviation and 95 density the circular difference between levels of categorical variables and the intercept.
circ.coef.means
The mean, mode, standard deviation and 95 circular means of the categorical variables.
model.fit
A list of information criteria for assessment of model fit.
mm
A list of information, model matrices, sample size, etc. on the specified model.
Source
Cremers, J., Mulder, K.T. & Klugkist, I. (2018). Circular interpretation of regression coefficients. British Journal of Mathematical and Statistical Psychology, 71(1), 75-95.
Cremers, J., Mainhard, M.T. & Klugkist, I. (2018). Assessing a Bayesian Embedding Approach to Circular Regression Models. Methodology, 14, 69-81.
Cremers, J. & Klugkist, I. (2018). One direction? A tutorial for circular data with examples in cognitive psychology. Frontiers in Psychology: Cognitive Science.
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
library(bpnreg)
bpnr(Phaserad ~ Cond + AvAmp, Motor)