Hi everyone,
I am currently doing some analysis on Peak Expiratory Flow Data (PEFR). I've recently learnt about Detrended Fluctuation Analysis (DFA) as a method for analyzing the variability of PEFR data. I've attached a link on DFA and the formula is:

From what I understand, the time series to be analyzed (with N samples) first has to be integrated. Then the integrated time series is divided into boxes of equal length, n (ie. 7 days). In each box of length n, a least squares line is fit to the data (representing the trend in that time interval). The y coordinate of the straight line segments is denoted by yn(k).
After this you have to detrend the integrated time series, y(k), by subtracting the local trend, yn(k), in each time interval . And finally the root-mean-square fluctuation of this integrated and detrended time series is performed.
I was wondering if anyone knew how to code stata to analyze my data to calculate the DFA? I know it can be done with Matlab, but I'd prefer to do it in stata if at all possible.
This is an example of my data:
thanks to anyone that can help
imran
I am currently doing some analysis on Peak Expiratory Flow Data (PEFR). I've recently learnt about Detrended Fluctuation Analysis (DFA) as a method for analyzing the variability of PEFR data. I've attached a link on DFA and the formula is:

From what I understand, the time series to be analyzed (with N samples) first has to be integrated. Then the integrated time series is divided into boxes of equal length, n (ie. 7 days). In each box of length n, a least squares line is fit to the data (representing the trend in that time interval). The y coordinate of the straight line segments is denoted by yn(k).
After this you have to detrend the integrated time series, y(k), by subtracting the local trend, yn(k), in each time interval . And finally the root-mean-square fluctuation of this integrated and detrended time series is performed.
I was wondering if anyone knew how to code stata to analyze my data to calculate the DFA? I know it can be done with Matlab, but I'd prefer to do it in stata if at all possible.
This is an example of my data:
Code:
+------------------+ | date PEFR | |------------------| 1. | 13mar2013 183 | 2. | 13mar2013 424 | 3. | 13mar2013 438 | 4. | 13mar2013 398 | 5. | 16apr2013 666 | |------------------| 6. | 16apr2013 606 | 7. | 17apr2013 562 | 8. | 17apr2013 708 | 9. | 18apr2013 550 | 10. | 18apr2013 597 | |------------------| 11. | 19apr2013 542 | 12. | 20apr2013 563 | 13. | 20apr2013 558 | 14. | 21apr2013 567 | 15. | 21apr2013 564 | |------------------| 16. | 22apr2013 591 | 17. | 22apr2013 571 | 18. | 23apr2013 579 | 19. | 24apr2013 503 | 20. | 24apr2013 591 | |------------------| 21. | 25apr2013 570 | 22. | 30apr2013 644 | 23. | 01may2013 464 | 24. | 01may2013 602 | 25. | 02may2013 533 | |------------------| 26. | 02may2013 573 | 27. | 03may2013 491 | 28. | 03may2013 562 | 29. | 06may2013 576 | 30. | 07may2013 498 | +------------------+
imran
Comment