Hello,
I have a panel data set which contains information on firms (given by REITID), the sector (Sectornumber) a firm operates in and I have a log return series of the firms' stockprice (TotalLogReturn). I managed to generate a graph of the variance of the log return series. I did so by calculating the Variance of the TotalLogReturn, by(Date). Now I want to graph the Variance series of the log return depending on the sector the firm operate in; for a total of 13 variance graphs for every sector. But I can't figure out how to do so. I tried xtline Variance i(Sector) t(Date) but It just generates the same Variance graph for every sector. Could you help me?
I have a panel data set which contains information on firms (given by REITID), the sector (Sectornumber) a firm operates in and I have a log return series of the firms' stockprice (TotalLogReturn). I managed to generate a graph of the variance of the log return series. I did so by calculating the Variance of the TotalLogReturn, by(Date). Now I want to graph the Variance series of the log return depending on the sector the firm operate in; for a total of 13 variance graphs for every sector. But I can't figure out how to do so. I tried xtline Variance i(Sector) t(Date) but It just generates the same Variance graph for every sector. Could you help me?
Code:
xtset REITID Date sort REITID Date by REITID: gen TotalLogReturn = log(TotalReturn[_n])-log(TotalReturn[_n-1]) egen SD = sd(TotalLogReturn), by(Date) gen Variance = SD^2 input float Date byte Sectornumber float(Variance TotalLogReturn) 171 1 . . 172 1 .01271399 .07647028 173 1 .014478557 .13145871 174 1 .005462709 .1797182 175 1 .01207985 .1280671 176 1 .013802183 .12089758 177 1 .022718094 -.02627064 178 1 .004700374 .07014332 179 1 .004386538 .098901 180 1 .005752772 -.012686453 181 1 .007845905 .14680628 182 1 .006333977 -.035694007 183 1 .005497316 .10743682 184 1 .007141759 .1601549 185 1 .005127982 .004204398 186 1 .006305829 .074752 187 1 .01694326 -.018864773 188 1 .006311047 .04138524 189 1 .009498115 -.0045783743 190 1 .01144282 .04413582 191 1 .015725248 -.05722305 192 1 .023222476 -.04872722 193 1 .016055752 -.0510096 194 1 .06492129 .08726103 195 1 .1656582 -.5275189 196 1 .12633483 -.28661945 197 1 .05336738 .1991516 198 1 .04322393 .1398275 199 1 .023571543 .11157066 200 1 .02383995 .05644141 201 1 .01842131 -.05937822 202 1 .10762425 .12065474 203 1 .02146371 -.04043105 204 1 .011512837 .03625132 205 1 .024182616 .07122423 206 1 .03887922 -.08280947 207 1 .028643524 .07350249 208 1 .0820109 .11163995 209 1 .12951487 .02777962 210 1 .02036335 .06785064 211 1 .01993032 .0103463 212 1 .025130564 .1011951 213 1 .08419436 -.11554944 214 1 .06420892 -.0004016963 215 1 .07555228 .006008491 216 1 .0840135 .06081253 217 1 .134007 .06228115 218 1 .007738933 -.018172609 219 1 .18569894 .14843237 220 1 .10825178 .09344856 221 1 .14502089 -.187984 222 1 .026267266 .032185115 223 1 .0886342 .09677877 224 1 .3085793 .06493157 225 1 .07441192 .0039215563 226 1 .07664512 .01992873 227 1 .01925132 -.1026542 228 1 .09450532 -.07764153 229 1 .009929138 -.08239751 171 2 . . 172 2 .01271399 .008298767 173 2 .014478557 .032523055 174 2 .005462709 .2086389 175 2 .01207985 -.10969877 176 2 .013802183 .10318407 177 2 .022718094 .29257214 178 2 .004700374 -.2366491 179 2 .004386538 -.0024751995 180 2 .005752772 -.02129074 181 2 .007845905 .04335041 182 2 .006333977 -.065104224 183 2 .005497316 .021753816 184 2 .007141759 .0037902505 185 2 .005127982 -.0101394 186 2 .006305829 .03135045 187 2 .01694326 -.0224728 188 2 .006311047 -.0025284954 189 2 .009498115 -.021753816 190 2 .01144282 -.016960636 191 2 .015725248 -.13805278 192 2 .023222476 .04864619 193 2 .016055752 -.1982754 194 2 .06492129 -.20145097 195 2 .1656582 -1.3009998 196 2 .12633483 .4123676 197 2 .05336738 -.3253563 198 2 .04322393 .54591703 199 2 .023571543 -.10919936 200 2 .02383995 -.007722039 201 2 .01842131 .1901077 202 2 .10762425 -.01948218 203 2 .02146371 -.04689976 204 2 .011512837 .279152 205 2 .024182616 -.04233433 206 2 .03887922 -.16411 207 2 .028643524 -.2042156 208 2 .0820109 .15191607 209 2 .12951487 -.07669263 210 2 .02036335 -.014598786 211 2 .01993032 -.150481 end format %tq Date
Comment