Making Rstan packages: Calling the compiled model from R script

rstan

#1

Hello,

I am attempting to make a packages based on stanarm.

The compilation is successfull and I have the following model

My question is: in my R code how can I call such compiled model? For example a wrong way would be:

fit = stan(
	  "src/stan_files/dirReg.stan",
	  data=list(
	    P=ncol(proportions),
	    S=nrow(my_design),
	    X=my_design,
	    R=ncol(my_design),
	    beta=proportions,
	    bg_mean = m
	  ),
	  cores=4,
	  refresh = 0
	)

alternatively I should call sampling(…?..)

Thanks for your help


#2

You should be calling sampling on the dirReg element of the list called stanmodels in your package’s namespace.