Hello everyone,
I am not a stellar Stata18 user, so forgive me if my question is dumb.
I have a database with several variables x1 x2 x3 x4 x5 ... x43 and I want to perform a cox regression (stcox) on all possible combinations of 3 variables. To do so, I implemented successfully the tuples command as:
tuples x1 x2 x3 ... x43, min(3) max(3)
which has created for me the 165 possible combinations. Then, I want to create a 165 x 1 matrix to store a value of "1" whenever all p-values associated to the 3 variables of analysis are < 0.05. I have performed this as:
matrix multivariata = J(165,1,.)
local j = 1
forval i = 1/165 {
I now have my matrix of interest multivariata, but I am unable to access the tuples in any meaningful way to label i-th row of my matrix as the variables in the i-th tuple. Is there anyway to do this?
Any help would be appreciated, thank you very much!
I am not a stellar Stata18 user, so forgive me if my question is dumb.
I have a database with several variables x1 x2 x3 x4 x5 ... x43 and I want to perform a cox regression (stcox) on all possible combinations of 3 variables. To do so, I implemented successfully the tuples command as:
tuples x1 x2 x3 ... x43, min(3) max(3)
which has created for me the 165 possible combinations. Then, I want to create a 165 x 1 matrix to store a value of "1" whenever all p-values associated to the 3 variables of analysis are < 0.05. I have performed this as:
matrix multivariata = J(165,1,.)
local j = 1
forval i = 1/165 {
qui stcox `tuple`i''
matrix mytab2 = r(table)
scalar pvalue1 = mytab2[4,1]
scalar pvalue2 = mytab2[4,2]
scalar pvalue3 = mytab2[4,3]
if pvalue1 < 0.05 & pvalue2 < 0.05 & pvalue3 < 0.05 {
matrix multivariata[`j', 1] = 1
}
local j = `j' + 1}
I now have my matrix of interest multivariata, but I am unable to access the tuples in any meaningful way to label i-th row of my matrix as the variables in the i-th tuple. Is there anyway to do this?
Any help would be appreciated, thank you very much!
Comment