Question: Formulate equation with different classes (categories) & subscripts

test.mw

Hi all,

Here is the problem, I will try my best to describe it:

 

Firstly of all,

 

log(p[j,c]/(1-p[j,c]))=mu+tau[j]+eta[c];

log(p[j,c]/(1-p[j,c]))=mu+tau[j]+eta[c]

In this system, the 'j' is a time varying parameter, and the 'c' is a class paramter. That is in class C1, we have

para1:=seq(log(p[j,1]/(1-p[j,1]))=mu+tau[j]+eta[1],j=2..4);
ans:=solve({para1},[seq(p[j,1],j=2..4)]);

and for class C2, we have

para2:=seq(log(p[j,2]/(1-p[j,2]))=mu+tau[j]+eta[2],j=2..4);

solve({para2},[seq(p[j,2],j=2..4)]);

##############################################

If there are many classes, it's time consuming the construct all of them. I don't know if there is an easier (more efficient) way to do this. Also, I used [j,c] notation to indicate the 'Class' category, I am not sure if it's the best way to do this.

 

Secondly,

In the above, the system can be solved. But if I want to use the output, say

p[2,1];

p[3,1];

w*p[4,1]+(1-w)*p[4,2]; # A weighted p[4]

They are not actually assigned. How should I assign them in batch? so p[j,c] can be used?

 

If you do not understand what I am after, please do ask.

Many thanks in advance!

test.mw

Casper

Please Wait...