On 10/18/13 3:12 PM, Ross Boylan wrote:
> On Fri, Oct 18, 2013 at 02:45:03PM -0400, Daniel Lee wrote:
>> Hi Ross,
>>
>> This isn't really a bug, but just a boundary condition where R's default
>> output for a single value matches up to Stan's real value, not a vector[1]
>> or matrix[1,1] or a real 1-array.
>>
>> There's a thread called "Specifying parameter/vector dimensions" that
>> covers most of the gory details. (
>>
https://groups.google.com/forum/?hl=en#!searchin/stan-users/Specifying$20parameter$2Fvector$20dimensions/stan-users/d-R7J6MldkQ/XMjtpX0bmTsJ
>> )
>>
>> In short, the variable needs to be defined as an array:
>>
>>> SDClass=array(sdclass[c(-2,-3)], dim=1)
>>>
>
> Thanks. I actually went the other way, and changed the stan code to
> use scalars. Using array would have been simpler.
>
> Before doing so, I ran into variant of the problem, this time with 2
> vs 1 dimensions instead of 1 vs 0:
>
> Error : mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=x; dims declared=(737,1); dims found=(737)
> failed to create the sampler; sampling not done
>
> So I changed
> matrix[N, J] x; // covariates
> to
> vector[N] x; // covariates
>
> Does this really need to be R's responsibility? It seems to me that if stan gets an argument of the appropriate
> size it should be able adjust if necessary.
our basic types. We want to catch user errors rather than
Type safety's always good. It's R that's bad!