interaction dummies
古いコメントを表示
I have two variables, time (T) with two values and region (R) with 10 values, and thus two sets of dummy variables. how can I get interaction dummies
dummyvar(T)*dummyvar(R) ?
3 件のコメント
bym
2012 年 4 月 20 日
can you give an example of your data?
Walter Roberson
2012 年 4 月 20 日
Is this possibly a question about covariance ?
Rabeya
2012 年 4 月 20 日
採用された回答
その他の回答 (1 件)
Walter Roberson
2012 年 4 月 20 日
group = [T, R];
row = mat2cell(group, ones(1, length(T)), 2);
Then row{1} would be your row1, row{2} would be your row2, and so on.
If you need automatically generated variables named row1, row2, and so on... then you are probably not programming optimally.
3 件のコメント
Rabeya
2012 年 4 月 20 日
Walter Roberson
2012 年 4 月 21 日
bsxfun() to do the multiplications.
sortrows(group_dummy, -1)
to sort based upon the first column in descending order
In this context, what do you mean by dummyvar(T) and dummyvar(R) ? T and R are numeric column vectors, right? And they are both 10 elements long in your example, so why would the number of columns in the dummy variables differ? Does it have to do with the number of unique values in each?
Rabeya
2012 年 4 月 21 日
カテゴリ
ヘルプ センター および File Exchange で Design of Experiments (DOE) についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!