creation of vectors from normal distribution
creation of vectors from normal distribution
I have a problem programming a CCR model with inputs and outputs. I need to extract the values to be used as input and output from a normal distribution. For this, I thought of creating two vectors of random variables (a and b) by extracting the values (through the normal function) from a normal distribution with mean and standard deviation which are inserted in two different tables. With the current setting (which you find in the attachment) the software gives me error 149.
Thanks for your help
Re: creation of vectors from normal distribution
Hi
You could search in this forum for Error 149 as strongly advised in the "Forum rules"...
or study the error message "149 Uncontrolled set entered as constant".
You define a parameter over the sets i and j, but on the right-hand side you use another set (p). Either your parameter is defined over all three sets, or you do something with the set p on the RHS (e.g. sum(p, .....)).
Cheers
Renger
You could search in this forum for Error 149 as strongly advised in the "Forum rules"...
Code: Select all
115 parameter a(i,j);
116 a(i,j)= normal(x(j,i),t(j,p));
You define a parameter over the sets i and j, but on the right-hand side you use another set (p). Either your parameter is defined over all three sets, or you do something with the set p on the RHS (e.g. sum(p, .....)).
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: creation of vectors from normal distribution
Thank you for your answer. I tried to add the index "p" to the vector a (i, j), becoming a (i, j, p) but I don't get what I want.
Code: Select all
parameter a(i,j,p);
a(i,j,p)= normal(x(j,i),t(j,p));
parameter b(r,j,q);
b(r,j,q)= normal(y(j,r),z(j,q));
I have to get a value extracted from the normal distribution for each "i" and for each "j" but the mean and standard deviation are inserted in two different tables.
I don't find how the "sum" function can help.
Thanks so much
Diana
Re: creation of vectors from normal distribution
Hi Diana
If I understand you correctly, the table t contains several variables and you want to use the mean of these values for j.
You can then just sum over p and divide by the rank of p (which gives you the number of elements of p):
Cheers
Renger
If I understand you correctly, the table t contains several variables and you want to use the mean of these values for j.
You can then just sum over p and divide by the rank of p (which gives you the number of elements of p):
Code: Select all
a(i,j)= normal(x(j,i),sum(p,t(j,p))/rank(p));
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist