Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • saving the t value and std in a loop regression

    Hello, I am running the regression among various dependent variables (I work on panel data), and I want to save the t value and std and beta to estimate the confidence band. But when I do this, just I get the results of firts dependent variable . I try to do a loop in the t value and std and beta. This is the smooth transition approach of Jorda`.

    However, I want to calculate one times in terms of "GDPgrowth_h_dumrec_sm" and "GDPgrowth_l_dumrec_sm" , which represent the high and low value of interaction term.

    Code:
    clear 
    foreach v in "ltotalfertility" "lntot_birth" "lnrate_fer1519_age" "lnrate_fer2024_age" "lnrate_fer2529_age" "lnrate_fer3034_age" "lnrate_fer3539_age" "lnrate_fer4044_age" "lnrate_fer4549_age" {
                
    foreach vart in "0" "1" "2" "3" "4" "5"           {     
    cd "D:\paper-thesis\MyProject - Copy/`v'"
    use "C:\Users\KHATEREH\Desktop\dataset_fertility_paper (2)-smooth.dta" 
    xi: statsby _b _se e(r2_a), clear: xtscc d`vart'`v' l(0/2)GDPgrowth_h_dumrec_sm l(0/2)GDPgrowth_l_dumrec_sm l(1/1)d0`v' d0`v'GDPgrowth_h_  d0`v'GDPgrowth_l_   i.year,fe
    
    foreach var in "GDPgrowth_h_dumrec_sm" {
        gen t_`var' = _b_`var'/_se_`var'
        gen time = "obs`vart'" 
    save d`vart'`v'.dta, replace
        }
        }
        }

    Thank you so much in advance for your valuable time and advice.

    best regards,

  • #2
    Can you provide us with output of an iteration? You can manually run it and check if the results you are looking for can be calculated from the resulting matrices. After the model is fitted, you can type ereturn list. Look for e(b) and e(V). With those matrices, you can calculate the t-values.
    Last edited by Tiago Pereira; 04 Feb 2022, 09:54.

    Comment

    Working...
    X