Announcement

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

  • Calculate the standard deviation of the firm's daily stock return over the past three months

    Hello everyone,

    I have daily panel data and I want to calculate the standard deviation of the firm's daily stock return over the past three months. Could anyone help me to find an appropriate code to calculate annualized 3-month rolling sample standard deviation and assuming the standard deviation is centered on zero, instead of centered around mean value given a time period.

    Sample of my dataset is attached :



    Kind Regards
    Obada






    Attached Files

  • Attaullah Shah
    replied
    The following two blog posts discuss the conversion of daily data to a weekly or monthly frequency, both for stock prices and stock returns

    https://fintechprofessor.com/ascol-s...y-and-monthly/

    https://fintechprofessor.com/2017/10...ct-of-returns/

    Leave a comment:


  • Clyde Schechter
    replied
    Example data using -dataex-, please.

    Leave a comment:


  • Zara Khan
    replied
    Dear Nick Cox and Clyde Schechter

    I have daily data of stock returns and I want to convert its frequency to weekly returns. can you please help me out in this regard by telling the appropriate code for it?

    Leave a comment:


  • Nick Cox
    replied
    I can't comment on #18's correctness except that a monthly date variable would be better formatted as %tm not %td.

    Leave a comment:


  • Zara Khan
    replied
    Thank you so much, Clyde, for your assistance. It really worked for me. I need some further help in the generation of another variable. It is as follows:

    DturnT: The difference between the average monthly share turnover over fiscal year T−1 and the average monthly share turnover over fiscal year T, where monthly share turnover is calculated as the monthly trading volume divided by the total number of shares outstanding over the month.

    I have used the following commands for generating this variable.

    gen month=mofd(date)
    format month %td
    bys month (date): keep if _n==_N
    tsset month
    **gen monthly share turnover
    gen mst= vol/ shrout
    **change in monthly share turnover
    gen d_mst=d.mst

    Kindly let me know whether the commands that I am using are correct enough for creating my desired variable.

    Leave a comment:


  • Clyde Schechter
    replied
    If I understand you correctly:
    Code:
    by permno year, sort: egen crash_variabe = max(return < mean - 3.09*sd)
    Replace "return" by the actual name of the variable containing the weekly return.

    Leave a comment:


  • Zara Khan
    replied
    Dear Nick Cox and Clyde Schechter

    I am calculating the stock price crash risk. The crash variable is measured as: An indicator variable that equals one if a firm experiences one or more firm-specific weekly returns exceeding 3.09
    standard deviations below the mean firm-specific weekly returns over the fiscal year and zero otherwise, with 3.09 chosen to generate frequencies of 0.1% in a normal distribution. I am having the firm-specific weekly returns and i have calculated the standard deviation and mean by the following commands:

    egen sd=sd(rret), by(permno year)

    egen mean=mean(rret), by(permno year)

    I want to ask that how I will generate the indicator variable to 1 if a firm experiences one or more firm-specific weekly returns exceeding 3.09 standard deviations below the mean firm-specific weekly returns. Kindly assist me in this regard.

    Regards

    Leave a comment:


  • Celine Tran
    replied
    Dear Clyde Schechter ,

    I appreciate your help. The main question I would like to ask is related to calcuate standard deviation at #10.

    I though that I can deal with "reshape" by myself ..., so that I post the question about standard deviation here. I am sorry.

    Regarding your code to reshape the panel data, it seems not to work with my data. I post in a new topic and would like to mention you there.

    I will back to this topic about standard deviation later.

    One a gain, thank you so much.

    Leave a comment:


  • Clyde Schechter
    replied
    This is a -reshape- problem, not a transposition.

    Code:
    rename A str_date
    foreach v of varlist IM-IP {
        rename `v' price_`=strtoname(`v'[1])'
    }
    drop in 1
    destring price_*, replace
    gen date = daily(str_date, "MDY")
    assert missing(date) == missing(str_date)
    format date %td
    drop str_date
    
    reshape long price_, i(date) j(firm) string
    rename price_ price
    This question really does not belong in this thread; it is off topic. While it is easy to think of these threads as dialogs between a questioner and a responder, in fact there are many others who read long on selected topics of interest, or who come and search for answers to their own questions in earlier posts. For the sake of those people and not wasting their time, it is important to keep threads on topic. In the future, when you are posing a question that is not clearly related to an existing thread, start a New Topic instead.

    Leave a comment:


  • Celine Tran
    replied
    Dear Nick Cox and Clyde Schechter ,

    For #12, I collect weekly stock price form Datastream. All data, including datem, is automatically download from Datastream. The raw data looks like:
    Code:
    input str10 A str17(IM IP)
    "Code"       "DISA.SI(RI)~U$"    "SUNR.SI(RI)~U$"  
    "  1/1/1998" "20.29"             "47.43"          
    "  1/8/1998" "17.06"             "28.04"          
    " 1/15/1998" "15.81"             "42.54"          
    " 1/22/1998" "15.82"             "42.56"          
    " 1/29/1998" "16.15"             "43.44"          
    "  2/5/1998" "24.41"             "45.14"          
    " 2/12/1998" "23.77"             "63.54"          
    " 2/19/1998" "22.6"              "64.55"          
    " 2/26/1998" "26.52"             "64.63"          
    "  3/5/1998" "21.5"              "63.61"          
    " 3/12/1998" "21.09"             "64.70999999999999"
    " 3/19/1998" "22.07"             "65.3"            
    " 3/26/1998" "23.01"             "62.59"          
    "  4/2/1998" "18.72"             "61.53"          
    "  4/9/1998" "18.3"              "39.24"          
    " 4/16/1998" "16.59"             "65.44"          
    " 4/23/1998" "16.73"             "50.3"            
    " 4/30/1998" "16.79"             "50.47"          
    "  5/7/1998" "14.8"              "38.41"          
    " 5/14/1998" "13.76"             "48.24"          
    " 5/21/1998" "15.49"             "48.88"          
    " 5/28/1998" "12.1"              "41.76"          
    "  6/4/1998" "11.26"             "42.94"          
    " 6/11/1998" "10.18"             "35.84"          
    " 6/18/1998" "11.38"             "37.41"          
    " 6/25/1998" "10.65"             "36.75"          
    "  7/2/1998" "9.66"              "47.02"          
    "  7/9/1998" "10.32"             "43.63"          
    " 7/16/1998" "9.060000000000001" "40.04"          
    " 7/23/1998" "8.140000000000001" "42.27"          
    " 7/30/1998" "7.37"              "42.1"            
    "  8/6/1998" "8"                 "41.55"          
    " 8/13/1998" "7.25"              "37"              
    " 8/20/1998" "7.98"              "36.99"          
    " 8/27/1998" "7.88"              "36.52"          
    "  9/3/1998" "7.94"              "35.34"          
    " 9/10/1998" "8.050000000000001" "35.83"          
    " 9/17/1998" "8.82"              "36"              
    " 9/24/1998" "7.37"              "39.1"            
    " 10/1/1998" "7.5"               "39.78"          
    " 10/8/1998" "6.91"              "35.27"          
    "10/15/1998" "8.66"              "40.14"          
    "10/22/1998" "9.380000000000001" "40.67"          
    "10/29/1998" "11.73"             "37.49"          
    " 11/5/1998" "12.5"              "47.83"          
    "11/12/1998" "10.69"             "51.39"          
    "11/19/1998" "11.71"             "54.14"          
    "11/26/1998" "11.5"              "53.21"          
    " 12/3/1998" "10.78"             "56.54"          
    "12/10/1998" "11.66"             "57.1"            
    "12/17/1998" "11.58"             "44.11"          
    "12/24/1998" "10.77"             "43.94"          
    "12/31/1998" "10.74"             "43.84"          
    "  1/7/1999" "11.37"             "43.29"          
    " 1/14/1999" "13.56"             "54.56"          
    " 1/21/1999" "13.64"             "47.16"          
    " 1/28/1999" "11.98"             "45.85"          
    "  2/4/1999" "12"                "39.04"          
    " 2/11/1999" "12"                "42.86"          
    " 2/18/1999" "13.4"              "42.54"          
    " 2/25/1999" "12.47"             "37.43"          
    "  3/4/1999" "13.13"             "37.21"          
    " 3/11/1999" "13.13"             "37.2"            
    " 3/18/1999" "12.47"             "37.42"          
    " 3/25/1999" "13.93"             "41.89"          
    "  4/1/1999" "13.19"             "37.37"          
    "  4/8/1999" "14.64"             "41.82"          
    " 4/15/1999" "14.96"             "55.7"            
    " 4/22/1999" "22.97"             "55.95"          
    " 4/29/1999" "20.15"             "51.78"          
    "  5/6/1999" "23.08"             "53.94"          
    " 5/13/1999" "22.27"             "46.95"          
    " 5/20/1999" "22.81"             "52.55"          
    " 5/27/1999" "26.33"             "74.63"          
    "  6/3/1999" "30.08"             "79.34"          
    " 6/10/1999" "35.43"             "78.33"          
    " 6/17/1999" "55.08"             "83.54000000000001"
    " 6/24/1999" "62.5"              "91.84999999999999"
    "  7/1/1999" "72.31999999999999" "108.02"          
    "  7/8/1999" "55.18"             "81.41"          
    " 7/15/1999" "44.74"             "57.82"          
    " 7/22/1999" "41.01"             "56.3"            
    " 7/29/1999" "42.76"             "59.69"          
    "  8/5/1999" "39.35"             "55.59"          
    " 8/12/1999" "34.06"             "52.51"          
    " 8/19/1999" "36.99"             "55.45"          
    " 8/26/1999" "47.15"             "65.67"          
    "  9/2/1999" "42.84"             "56.74"          
    "  9/9/1999" "42.77"             "58.18"          
    " 9/16/1999" "41.89"             "58"              
    " 9/23/1999" "41.37"             "54.27"          
    " 9/30/1999" "37.23"             "53.18"          
    " 10/7/1999" "40.71"             "55.38"          
    "10/14/1999" "39.97"             "53.86"          
    "10/21/1999" "37.92"             "51.07"          
    "10/28/1999" "36.45"             "50.36"          
    " 11/4/1999" "40.27"             "55.82"          
    "11/11/1999" "46.1"              "60.92"          
    "11/18/1999" "45.49"             "59.56"          
    end
    Because the raw date is exported from Datastream in a form of row, the first column is Date, the sencond column is stock price of firm 1, the thirst column is for firm 2 and so on.....

    Before calculating the standard deviation that I mentioned in #10, I need to format the raw data. In details, I need to transpose the panel data to the form that all firms are in one column, and then the next column is Date. But I do not know how to do. Could you please help? The one I post in #10 is from my mamuanlly transposing.

    Thank you very much in advance.

    Regards,
    Celine
    Last edited by Celine Tran; 24 Feb 2020, 18:46.

    Leave a comment:


  • Clyde Schechter
    replied
    However, there are some problem here. The number of weeks for each year maybe different . I means it is not always 52 weeks each year. So, I do not know what should I do.

    Well, imagine for the moment that you were going to do these calculations by hand. (To be very, very clear, I am not recommending you actually do that--this is a thought experiment.) How would you know which weeks to include in each case? If you can explain that, it will probably not be too hard to write code that corresponds to it. Looking at your example data, it is not obvious to me why the number of weeks should vary from one instance to another, nor where the information defining the included weeks would come from.

    Leave a comment:


  • Nick Cox
    replied
    https://www.statalist.org/forums/help#stata is the link I alluded to earlier, which tells you how to improve your data examples.

    Leave a comment:


  • Celine Tran
    replied
    Dear Nick Cox ,

    Thank you for your reply. I do not ask about specialist calculations. I understand what your responese at #7. Therefore, ,my question is different. I would like to know how to use rangestat to calulate the standard deviation of certain number of obs.

    Here is my data.

    Code:
    TRCode Date return
    GPRL 1/2/2014 
    GPRL 1/9/2014 .0308133
    GPRL 1/16/2014 -.0013903
    GPRL 1/23/2014 -.03063
    GPRL 1/30/2014 .0233393
    GPRL 2/6/2014 -.0614035
    GPRL 2/13/2014 .0007477
    GPRL 2/20/2014 .0085917
    GPRL 2/27/2014 -.0003704
    GPRL 3/6/2014 .1081882
    GPRL 3/13/2014 .0177198
    GPRL 3/20/2014 -.0466491
    GPRL 3/27/2014 .0434183
    GPRL 4/3/2014 .0904888
    GPRL 4/10/2014 .0529982
    GPRL 4/17/2014 -.0353753
    GPRL 4/24/2014 .0399523
    GPRL 5/1/2014 .016055
    GPRL 5/8/2014 -.0513544
    GPRL 5/15/2014 .0960738
    GPRL 5/22/2014 .1082768
    GPRL 5/29/2014 -.0022037
    GPRL 6/5/2014 -.0262577
    GPRL 6/12/2014 -.0438508
    GPRL 6/19/2014 -.0005271
    GPRL 6/26/2014 .0780591
    GPRL 7/3/2014 .0273973
    GPRL 7/10/2014 .0754762
    GPRL 7/17/2014 .0225814
    GPRL 7/24/2014 .0441654
    GPRL 7/31/2014 -.0470661
    GPRL 8/7/2014 -.0461271
    GPRL 8/14/2014 -.0866788
    GPRL 8/21/2014 -.017982
    GPRL 8/28/2014 .0155137
    GPRL 9/4/2014 -.0042575
    GPRL 9/11/2014 -.02666
    GPRL 9/18/2014 .0173127
    GPRL 9/25/2014 -.001016
    GPRL 10/2/2014 -.0030511
    GPRL 10/9/2014 .0015302
    GPRL 10/16/2014 -.1033868
    GPRL 10/23/2014 -.0227208
    GPRL 10/30/2014 .0784656
    GPRL 11/6/2014 -.0285637
    GPRL 11/13/2014 .0183079
    GPRL 11/20/2014 -.0332335
    GPRL 11/27/2014 -.0369118
    GPRL 12/4/2014 -.0263312
    GPRL 12/11/2014 -.0090144
    GPRL 12/18/2014 -.0451789
    GPRL 12/25/2014 -.0123849
    GPRL 1/1/2015 -.0318328
    GPRL 1/8/2015 -.0099635
    GPRL 1/15/2015 .0073801
    GPRL 1/22/2015 .038628
    GPRL 1/29/2015 .0057711
    GPRL 2/5/2015 .0044629
    GPRL 2/12/2015 -.0729927
    GPRL 2/19/2015 .0619651
    GPRL 2/26/2015 .0367505
    GPRL 3/5/2015 -.0951493
    GPRL 3/12/2015 .0683849
    GPRL 3/19/2015 .0331296
    GPRL 3/26/2015 .0554172
    GPRL 4/2/2015 .0073746
    GPRL 4/9/2015 .0430454
    GPRL 4/16/2015 .0235823
    GPRL 4/23/2015 .0112452
    GPRL 4/30/2015 .0008137
    GPRL 5/7/2015 -.0468835
    GPRL 5/14/2015 .005118
    GPRL 5/21/2015 -.0523338
    GPRL 5/28/2015 .0295522
    GPRL 6/4/2015 .0034793
    GPRL 6/11/2015 .0167582
    GPRL 6/18/2015 .0048309
    GPRL 6/25/2015 -.0079186
    GPRL 7/2/2015 -.0142531
    GPRL 7/9/2015 -.0575477
    GPRL 7/16/2015 -.0104326
    GPRL 7/23/2015 -.020155
    GPRL 7/30/2015 -.0170886
    GPRL 8/6/2015 .0534449
    GPRL 8/13/2015 -.021088
    GPRL 8/20/2015 -.049641
    GPRL 8/27/2015 -.0588042
    GPRL 9/3/2015 -.0104712
    GPRL 9/10/2015 -.038448
    GPRL 9/17/2015 .0172414
    GPRL 9/24/2015 .0151461
    GPRL 10/1/2015 -.0017762
    GPRL 10/8/2015 .03879
    GPRL 10/15/2015 .0226105
    GPRL 10/22/2015 -.0107203
    GPRL 10/29/2015 -.1381646
    GPRL 11/5/2015 -.0227898
    GPRL 11/12/2015 .0261359
    GPRL 11/19/2015 -.0525078
    GPRL 11/26/2015 -.0107527
    GPRL 12/3/2015 -.0426421
    GPRL 12/10/2015 .0004367
    GPRL 12/17/2015 -.045395
    GPRL 12/24/2015 -.0310928
    GPRL 12/31/2015 .0122699
    GPRL 1/7/2016 -.0097902
    GPRL 1/14/2016 .0390772
    GPRL 1/21/2016 .0616221
    GPRL 1/28/2016 .0072557
    GPRL 2/4/2016 .0224576
    GPRL 2/11/2016 .002901
    GPRL 2/18/2016 -.0082645
    GPRL 2/25/2016 .0004167
    GPRL 3/3/2016 .18409
    GPRL 3/10/2016 -.2244108
    GPRL 3/17/2016 .0435374
    GPRL 3/24/2016 -.0147762
    GPRL 3/31/2016 .0816056
    GPRL 4/7/2016 -.0619902
    GPRL 4/14/2016 .0530435
    GPRL 4/21/2016 -.0082576
    GPRL 4/28/2016 .0399667
    GPRL 5/5/2016 .0064051
    GPRL 5/12/2016 -.0453461
    GPRL 5/19/2016 -.0079167
    GPRL 5/26/2016 .0041999
    GPRL 6/2/2016 .019657
    GPRL 6/9/2016 .4364233
    GPRL 6/16/2016 -.1956025
    GPRL 6/23/2016 .0099397
    GPRL 6/30/2016 -.0042179
    GPRL 7/7/2016 .204377
    GPRL 7/14/2016 -.0521688
    GPRL 7/21/2016 -.3107607
    GPRL 7/28/2016 .0897263
    GPRL 8/4/2016 -.0526966
    GPRL 8/11/2016 -.0425902
    GPRL 8/18/2016 .1130277
    GPRL 8/25/2016 .0297716
    GPRL 9/1/2016 .0154455
    GPRL 9/8/2016 -.0292512
    GPRL 9/15/2016 .0269184
    GPRL 9/22/2016 .0449922
    GPRL 9/29/2016 .0475477
    GPRL 10/6/2016 .0268049
    GPRL 10/13/2016 -.0090498
    GPRL 10/20/2016 .0779768
    GPRL 10/27/2016 .0130336
    GPRL 11/3/2016 -.0681891
    GPRL 11/10/2016 -.0176044
    GPRL 11/17/2016 -.0049192
    GPRL 11/24/2016 -.0105932
    GPRL 12/1/2016 .0021413
    GPRL 12/8/2016 .0192308
    GPRL 12/15/2016 -.0132774
    GPRL 12/22/2016 .0290368
    GPRL 12/29/2016 .0141087
    GPRL 1/5/2017 .0302002
    GPRL 1/12/2017 .0032938
    GPRL 1/19/2017 -.0338148
    GPRL 1/26/2017 .0502888
    GPRL 2/2/2017 .0116467
    GPRL 2/9/2017 -.0070355
    GPRL 2/16/2017 -.0144928
    GPRL 2/23/2017 .0395425
    GPRL 3/2/2017 .0543854
    GPRL 3/9/2017 -.0068575
    GPRL 3/16/2017 -.0141099
    GPRL 3/23/2017 .0301462
    GPRL 3/30/2017 -.0381318
    GPRL 4/6/2017 .0236632
    GPRL 4/13/2017 .0030021
    GPRL 4/20/2017 .0565699
    GPRL 4/27/2017 .0127479
    GPRL 5/4/2017 .0237762
    GPRL 5/11/2017 -.0795082
    GPRL 5/18/2017 .0418522
    GPRL 5/25/2017 .0635328
    GPRL 6/1/2017 -.0008036
    GPRL 6/8/2017 .016622
    GPRL 6/15/2017 .0263713
    GPRL 6/22/2017 .0465057
    GPRL 6/29/2017 .0078566
    GPRL 7/6/2017 -.0267966
    GPRL 7/13/2017 .0297872
    GPRL 7/20/2017 .033544
    GPRL 7/27/2017 -.020461
    GPRL 8/3/2017 -.0489796
    GPRL 8/10/2017 -.01641
    GPRL 8/17/2017 -.0277207
    GPRL 8/24/2017 .029831
    GPRL 8/31/2017 .0158934
    GPRL 9/7/2017 -.0406258
    GPRL 9/14/2017 -.0068385
    GPRL 9/21/2017 -.0007945
    GPRL 9/28/2017 -.0055659
    GPRL 10/5/2017 -.0029318
    GPRL 10/12/2017 -.02085
    GPRL 10/19/2017 -.015834
    GPRL 10/26/2017 -.0061026
    GPRL 11/2/2017 .0178621
    GPRL 11/9/2017 -.0008226
    GPRL 11/16/2017 .0321076
    GPRL 11/23/2017 .0071789
    GPRL 11/30/2017 -.0285111
    GPRL 12/7/2017 .0548913
    GPRL 12/14/2017 -.052035
    GPRL 12/21/2017 -.0407609
    GPRL 12/28/2017 .0048159
    TISE 1/2/2014 
    TISE 1/9/2014 -.0278686
    TISE 1/16/2014 -.0013164
    TISE 1/23/2014 .0458407
    TISE 1/30/2014 -.0211455
    TISE 2/6/2014 -.0187411
    TISE 2/13/2014 .0508821
    TISE 2/20/2014 -.0226138
    TISE 2/27/2014 .0242725
    TISE 3/6/2014 -.0467018
    TISE 3/13/2014 -.0267481
    TISE 3/20/2014 -.0089619
    TISE 3/27/2014 -.0001507
    TISE 4/3/2014 .0064818
    TISE 4/10/2014 .0220159
    TISE 4/17/2014 .0033705
    TISE 4/24/2014 -.0163575
    TISE 5/1/2014 .009948
    TISE 5/8/2014 .0263158
    TISE 5/15/2014 -.0508523
    TISE 5/22/2014 -.0105644
    TISE 5/29/2014 .0359976
    TISE 6/5/2014 .0136926
    TISE 6/12/2014 .042992
    TISE 6/19/2014 -.0403843
    TISE 6/26/2014 -.0007256
    TISE 7/3/2014 .0027592
    TISE 7/10/2014 .0194062
    TISE 7/17/2014 -.0099446
    TISE 7/24/2014 .0007175
    TISE 7/31/2014 -.0055922
    TISE 8/7/2014 -.0027397
    TISE 8/14/2014 -.0005784
    TISE 8/21/2014 .0021701
    TISE 8/28/2014 -.0153024
    TISE 9/4/2014 -.0042516
    TISE 9/11/2014 -.0278269
    TISE 9/18/2014 -.0137816
    TISE 9/25/2014 -.0116708
    TISE 10/2/2014 .0023306
    TISE 10/9/2014 -.0148814
    TISE 10/16/2014 -.0314713
    TISE 10/23/2014 -.029082
    TISE 10/30/2014 -.001004
    TISE 11/6/2014 .0335008
    TISE 11/13/2014 -.0427877
    TISE 11/20/2014 .0220115
    TISE 11/27/2014 .018224
    TISE 12/4/2014 -.0261959
    TISE 12/11/2014 -.0203843
    TISE 12/18/2014 .0006822
    TISE 12/25/2014 -.0352821
    TISE 1/1/2015 .0641343
    TISE 1/8/2015 -.0654159
    TISE 1/15/2015 .0191864
    TISE 1/22/2015 -.0282378
    TISE 1/29/2015 -.0001794
    TISE 2/5/2015 .0405454
    TISE 2/12/2015 -.0432759
    TISE 2/19/2015 -.0720851
    TISE 2/26/2015 .0075743
    TISE 3/5/2015 -.0354665
    TISE 3/12/2015 -.044964
    TISE 3/19/2015 -.000837
    TISE 3/26/2015 .0433508
    TISE 4/2/2015 .007226
    TISE 4/9/2015 -.0984456
    TISE 4/16/2015 .061229
    TISE 4/23/2015 .0131223
    TISE 4/30/2015 -.0117188
    TISE 5/7/2015 -.0062409
    TISE 5/14/2015 -.025539
    TISE 5/21/2015 .0227712
    TISE 5/28/2015 -.0247847
    TISE 6/4/2015 .003446
    TISE 6/11/2015 .0002146
    TISE 6/18/2015 .0834764
    TISE 6/25/2015 -.0883343
    TISE 7/2/2015 .011297
    TISE 7/9/2015 -.0238453
    TISE 7/16/2015 -.0103433
    TISE 7/23/2015 .019791
    TISE 7/30/2015 -.0196249
    TISE 8/6/2015 -.0507117
    TISE 8/13/2015 .0513121
    TISE 8/20/2015 -.0109204
    TISE 8/27/2015 -.3050924
    TISE 9/3/2015 .0311284
    TISE 9/10/2015 .0003145
    TISE 9/17/2015 .0204338
    TISE 9/24/2015 .0070856
    TISE 10/1/2015 .3386357
    TISE 10/8/2015 -.226691
    TISE 10/15/2015 .0227541
    TISE 10/22/2015 .0366946
    TISE 10/29/2015 .0604794
    TISE 11/5/2015 -.0010512
    TISE 11/12/2015 .2423047
    TISE 11/19/2015 -.2166455
    TISE 11/26/2015 .0481211
    TISE 12/3/2015 .0247614
    TISE 12/10/2015 -.0201359
    TISE 12/17/2015 -.0133573
    TISE 12/24/2015 .0106743
    TISE 12/31/2015 .0528078
    TISE 1/7/2016 -.0680206
    TISE 1/14/2016 -.003413
    TISE 1/21/2016 -.1454162
    TISE 1/28/2016 .0317509
    TISE 2/4/2016 .1443083
    TISE 2/11/2016 .024282
    TISE 2/18/2016 -.1738465
    TISE 2/25/2016 .1255785
    TISE 3/3/2016 .0317982
    TISE 3/10/2016 .0286929
    TISE 3/17/2016 .0433884
    TISE 3/24/2016 -.0556931
    TISE 3/31/2016 .0180865
    TISE 4/7/2016 .0399073
    TISE 4/14/2016 -.0505076
    TISE 4/21/2016 .011734
    TISE 4/28/2016 0
    TISE 5/5/2016 -.075
    TISE 5/12/2016 .0401226
    TISE 5/19/2016 .0375033
    TISE 5/26/2016 .091402
    TISE 6/2/2016 -.0603265
    TISE 6/9/2016 .0392749
    TISE 6/16/2016 -.0016957
    TISE 6/23/2016 .009949
    TISE 6/30/2016 -.0456511
    TISE 7/7/2016 .041289
    TISE 7/14/2016 .0050774
    TISE 7/21/2016 -.0108251
    TISE 7/28/2016 .0026751
    TISE 8/4/2016 -.0133398
    TISE 8/11/2016 .0427729
    TISE 8/18/2016 .0014144
    TISE 8/25/2016 -.0301318
    TISE 9/1/2016 -.0245146
    TISE 9/8/2016 .0303558
    TISE 9/15/2016 -.0326008
    TISE 9/22/2016 .0072391
    TISE 9/29/2016 .0146221
    TISE 10/6/2016 -.0075721
    TISE 10/13/2016 -.0504553
    TISE 10/20/2016 -.0049248
    TISE 10/27/2016 .0630372
    TISE 11/3/2016 -.1359961
    TISE 11/10/2016 .1463415
    TISE 11/17/2016 -.065809
    TISE 11/24/2016 -.0323093
    TISE 12/1/2016 .0021894
    TISE 12/8/2016 .0027307
    TISE 12/15/2016 .0087146
    TISE 12/22/2016 -.0029698
    TISE 12/29/2016 -.0232873
    TISE 1/5/2017 .03715
    TISE 1/12/2017 .0248597
    TISE 1/19/2017 -.0245175
    TISE 1/26/2017 -.018984
    TISE 2/2/2017 -.0106296
    TISE 2/9/2017 .038292
    TISE 2/16/2017 -.0212258
    TISE 2/23/2017 .0759013
    TISE 3/2/2017 .0788612
    TISE 3/9/2017 -.0450724
    TISE 3/16/2017 .0141844
    TISE 3/23/2017 .0217024
    TISE 3/30/2017 -.0160491
    TISE 4/6/2017 .0741185
    TISE 4/13/2017 .0031264
    TISE 4/20/2017 -.0552093
    TISE 4/27/2017 .0188501
    TISE 5/4/2017 -.0407031
    TISE 5/11/2017 .0460463
    TISE 5/18/2017 .0313436
    TISE 5/25/2017 .024581
    TISE 6/1/2017 -.0008724
    TISE 6/8/2017 .0406025
    TISE 6/15/2017 -.0004196
    TISE 6/22/2017 .0304302
    TISE 6/29/2017 -.0099796
    TISE 7/6/2017 .0514297
    TISE 7/13/2017 .1062414
    TISE 7/20/2017 .0083127
    TISE 7/27/2017 -.0114015
    TISE 8/3/2017 .0168559
    TISE 8/10/2017 -.0342
    TISE 8/17/2017 -.0325203
    TISE 8/24/2017 -.0304388
    TISE 8/31/2017 .0025039
    TISE 9/7/2017 .081268
    TISE 9/14/2017 -.0069296
    TISE 9/21/2017 .0309537
    TISE 9/28/2017 -.0208261
    TISE 10/5/2017 .0436016
    TISE 10/12/2017 .0823709
    TISE 10/19/2017 .0400126
    TISE 10/26/2017 -.006035
    TISE 11/2/2017 .0034912
    TISE 11/9/2017 .0654969
    TISE 11/16/2017 -.0340715
    TISE 11/23/2017 -.0191064
    TISE 11/30/2017 .0394067
    TISE 12/7/2017 .0106674
    TISE 12/14/2017 -.0359435
    TISE 12/21/2017 .0285545
    TISE 12/28/2017 -.0208573
    I only provide the weekly data for 2 companies from 2014 to 2017. Now, I would like to calculate the variable which is standard deviations of previous two years' stock return. For example, the value of this variable of company GPRL for year 2016 will be the standard devidation of previous 104 weeks (from year 2014 to year 2015, I count that there are 104 weeks, each year has 52 weeks ).

    However, there are some problem here. The number of weeks for each year maybe different . I means it is not always 52 weeks each year. So, I do not know what should I do.

    Could you please help. Thank you very much in advance.

    I do apologise because my data is messy. Honestly, I do not how to post it here as others do.
    Last edited by Celine Tran; 22 Feb 2020, 18:11.

    Leave a comment:


  • Nick Cox
    replied
    #8

    From #7 I echo

    My claiming ignorance of specialist calculations for finance is not false modesty, but genuine.
    What do other people do with such data?

    Otherwise p\lease give a data example. FAQ Advice #12 applies as always.

    What does a variable month have to do with a question about weekly data?

    Leave a comment:

Working...
X