MATLAB Answers

How to run a regression of lognrnd?

2 views (last 30 days)
Fernanda Suarez Jaimes
Fernanda Suarez Jaimes on 12 Mar 2020
I have a vector with random data log-norm distributed and I need to run a regression of this.
  5 Comments
Fernanda Suarez Jaimes
Fernanda Suarez Jaimes on 12 Mar 2020
This is another option I have. The issue is that we need to do a regression of a time series. Therefore, the result of the model is not significant as it is near 0,05.
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

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 12 Mar 2020
It sounds like you want the lognfit function.
  1 Comment
Fernanda Suarez Jaimes
Fernanda Suarez Jaimes on 12 Mar 2020
You mean something as this?
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
[pHat,pCI] = lognfit(time_series2,0.01)
The result I get is this:
pHat =
0.0017 0.2494
pCI =
-0.0066 0.2437
0.0100 0.2554

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!