Learn R Programming

hbmem (version 0.3-3)

sampleSig2b: Function sampleSig2b

Description

Samples posterior of the variance of a normal distibution which has the same additive structure on the mean and the log of variance. Usually used within MCMC loop.

Usage

sampleSig2b(sample,y,cond,sub,item,lag,N,I,J,R,ncond,nsub,nitem,
s2mu,s2a,s2b,met,blockMean,sampLag=1,Hier=1)

Value

The function returns a new sample of a block of Sigma2 paramters.

Arguments

sample

Previous sample of block variances.

y

Vector of data

cond

Vector of condition index,starting at zero.

sub

Vector of subject index, starting at zero.

item

Vector of item index, starting at zero.

lag

Vector of lag index, zero-centered.

N

Number of conditions.

I

Number of subjects.

J

Number of items.

R

Total number of trials.

ncond

Vector of length (N) containing number of trials per each condition.

nsub

Vector of length (I) containing number of trials per each subject.

nitem

Vector of length (J) containing number of trials per each item.

s2mu

Prior variance on the grand mean mu; usually set to some large number.

s2a

Shape parameter of inverse gamma prior placed on effect variances.

s2b

Rate parameter of inverse gamma prior placed on effect variances. Setting both s2a AND s2b to be small (e.g., .01, .01) makes this an uninformative prior.

met

Vector of metropolis-hastins tuning parameters.

blockMean

Block of parameters for the mean of the distribution.

sampLag

Logical. Whether or not to sample the lag effect.

Hier

Logical. If TRUE then effect variances are estimated from data. If FALSE then these values are set to whatever value is in the s2alpha and s2beta slots of sample. This should always be set to TRUE.

Author

Michael S. Pratte

Details

This function is for a model with an additive structure on the log of the variance of a normal distribuiton. This model is under development, the code is buggy, and it might not even work in the end.

See Also

hbmem,sampleNormb

Examples

Run this code
#See sampleNormb for example

Run the code above in your browser using DataLab