How to run a regression of a time series with random data and log-norm distribution?
3 views (last 30 days)
Show older comments
I have a vector containing 6,000 random entries distributed with log-norm. What type of regression model should I use?
This is my dataset
% generating time series with 6000 entries log-normal distributed
rng ( 'default' ); % So that numbers can be repeated
time_series2 = lognrnd (0,0.25,6000,1); % generating time series with mu set to zero and sigma 0.25
This is what I have so far
% REGRESSION TIME SERIES 2
logarithms_ts2 = log (time_series2); % calculating logarithm of the values in order to use GLM fuction
% [regression2, dev, stats] = glmfit (xtime2, logarithms_ts2, 'normal');
regression2 = fitglm (xtime2, time_series2) % regression of time series 2
% GLM function does not support lognormal distributions, so the logarithms
% are calculated in order to use the GLM fit function with the use of normal
% distribution https://www.mathworks.com/matlabcentral/answers/101420-why-does-the-glmfit-function-not-recognize-lognormal-as-a-distribution
0 Comments
Answers (0)
See Also
Categories
Find more on Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!