Runtime error when matrix parameter has matrix offset & multiplier

Hey folks, I’m looking to use the “new” (I know, it’s been around for ages now; I just haven’t started using it until now) offset & multiplier feature to non-center-parameterize a hierarchical model. I have a version working whereby I do (excuse my idiosyncratic use of whitespace):

	real mean_subj_mean ;
	real<lower=0> sd_subj_mean ;
		offset = mean_subj_mean
		, multiplier = sd_subj_mean
	>[num_subjects] subj_mean ;

Then I attempt to expand my model to a scenario where subj_mean is a matrix:

	vector[num_locs] mean_subj_mean ;
	vector<lower=0>[num_locs] sd_subj_mean ;
		offset = rep_matrix(mean_subj_mean,num_subjects)
		, multiplier = rep_matrix(sd_subj_mean,num_subjects)
	>[num_locs,num_subjects] subj_mean ;

Which passes the syntax checker, but yields a runtime error:

Exception: constraint: subj_mean ((3, 10)10, 3) must match in size

Am I doing something wrong, or is a matrix-valued offset & multiplier not possible?

Oops, my bad. I had it right after all; error message was from an older compile.

1 Like