Hello everyone,

I am doing a research paper on informational efficiency (IE1). It is calculated by "the return variance ratio, i.e. n/m times the ratio of the m-day return variance to the n-day return variance. IE1 is computed using VR(1,5)"
I am using a CRPS merged with Compustat/CRPS Merged databased.

I have already calculated the variance ratio with the following code: ( i have added the command I have used to set up my data first

keep if year(date)==2017
sort permno date
tsset permno date
duplicates tag permno date, gen(isdup)
edit if isdup
drop isdup
drop if exchcd>3
drop if exchcd<3 (to keep only NASDAQ traded stocks)

** Find the 1-day and the 5-day log return
gen LOGRET1 = log(1+ret)
gen LOGRET1_L1 = l1.LOGRET1
gen LOGRET1_L2 = l2.LOGRET1
gen LOGRET1_L3 = l3.LOGRET1
gen LOGRET1_L4 = l4.LOGRET1
gen LOGRET5 = LOGRET1 + LOGRET1_L1 + LOGRET1_L2 + LOGRET1_L3 + LOGRET1_L4

** Find the standard deviation of the 1-day and the 5-day log return
egen sdlag5 = sd(LOGRET5),by(permno)
egen sdlag1=sd(LOGRET1),by(permno)
*****************************************

gen varlag1= sdlag1^2
gen varlag5= sdlag5^2
gen VRratio15= varlag5/ varlag1
gen VRratio= VRratio15/5
gen spread=[bid-ask]/[[bid+ask]*2]
collapse VRratio spread,by(permno)

After this I merged the data 1:1 with compustat.

VR is called here VRratio in my DOFILE. I am using STATA 16.0.
Now I was advised
to calculate IE1 by doing
|VR-1|. I am not sure what to do next, any suggestions or command I should use to get my variable IE1?

Thank you in advance very much for any help you can provide!
Btw, I am a beginner with stata, I found my way through with the help of my teacher who is now not available to help me anymore.. I am quite blocked with this issue.

Bests,

Marc