Quantcast
Viewing all articles
Browse latest Browse all 26

Re: inf values for mean(___) and sum(___) functions

"dpb" wrote in message <mhnvpq$t64$1@dont-email.me>...
> On 04/27/2015 11:19 PM, Christoph Meier wrote:
> > Dear Matlab community,
> >
> > I am currently facing a little issue:
> >
> > I have a matrix with share volume (SHVOL) and shares outstanding
> > (SHROUT). Both are over the same time period and the same companies, of
> > course. Since the dataset is very long, it contains a lot of NANs.
> >
> > I would like to compute share turnover (TURNO), which is
> > (SHVOL)/(SHROUT). I use the following code for that:
> >
> > TURNO = (abs(SHVOL)./abs(SHROUT);
> >
> > after that, I want to compute the mean turnover (mTURNO) for each period:
> >
> > mTURNO = nanmean(ans(TURNO),2);
> >
> > nanmean computes the mean while ignoring NANs, and 2 indicates a mean of
> > column values.
> >
> > Mast values of my (n x 1) mTURNO matrix look fine, but some of them
> > state 'inf'. There is clearly some error. Does anyone have a suggestion
> > how to fix it?
> >
> ...
>
> More than likely you've created some Inf values in the division step --
> if SHROUT --> 0 and SHVOL isn't, that's going to be the result. What is
> the proper thing to do is dependent upon the analysis--removing such
> from the dataset might be a starting point unless the time is also
> significant.
>
> As an aside, why the abs(); aren't both volume and turnover just quantities?
>
> --
Hi dtp,

thank you very much for your suggestion, I will check for that!

I used abs(), as I wanted to exclude NANs. I suppose there is a better way to do that, but I am still a MATLAB rookie.

Thank you very much!

Chris

Viewing all articles
Browse latest Browse all 26

Trending Articles