tests/test-rstan.R

require("relcs")

num.obs <- 5
N <- 500

# create data
sdata <- relcs::simulateDataFromRELCS(N=500, num.obs = num.obs,selffeedback.mean = .2,
                              selffeedback.variance = .05,residualerrorvariance = 1,
                             slopemu = 0, slopevariance = 0, interceptmu = 5, interceptvariance = 1,
                             has.slope=FALSE)


# use STAN
control <- list(adapt_delta=0.99,max_treedepth=20)
control <- NULL
iter <- 200
algorithm <- "NUTS"
#algorithm <- "HMC"
result <- fitRELCS.stan(num.obs = num.obs, data=sdata, iter=iter,
                        warmup=iter/5, control=control, algorithm=algorithm,seed = 123)


print( getEstimates(result) )
brandmaier/relcs documentation built on March 27, 2021, 1:32 p.m.