Rank: 79 based on 1897 downloads (last 30 days) and 11 files submitted
photo

Francisco de Castro

E-mail
Company/University
Potsdam University
Lat/Long
52.403778, 13.02696

Personal Profile:

Professional Interests:
Theoretical Ecology

 

Watch this Author's files

 

Files Posted by Francisco View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro kurtosis, minimum, quartile, maximum, skewness, mode 258 5
  • 3.5
3.5 | 2 ratings
29 Oct 2009 Screenshot Qplot Menu driven GUI for creating many graph types Author: Francisco de Castro correlation, qqplot, contour, normplot, surface, plot 357 5
  • 3.75
3.8 | 4 ratings
02 Sep 2009 ODE2STAB Integrates systems of differential equations until stability is reached (or time is over) Author: Francisco de Castro ode, stability, differential equation, ode solver, ode45 133 0
06 Aug 2009 Screenshot ANYRND Generates random numbers from an arbitrary user-defined frequency distribution Author: Francisco de Castro random number, statistics, frequency distributio... 133 0
12 Sep 2008 Screenshot Increase Image Resolution Increases the resolution of an image by interpolation Author: Francisco de Castro size, pixel, resolution, image, enhancement, pp 217 0
Comments and Ratings by Francisco View all
Updated File Comments Rating
04 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro

Tried to address the comments by Hanselman and Jos. The requirement of the Statistics TB is now shown. Help is (hopefully) less ambiguous. Some error checking is included, for numeric arguments and sizes of data and groups. By the way, examples WERE given from the beginning.

Grouping now works for the cases mentioned by Jos, i.e. the following cases all work:
allstats(rand(1,5),1:5)
allstats(rand(1,5),(1:5)')
allstats(rand(5,1),1:5)

Regarding Jos #2 comment: I don't see the advantage of using NARGIN > 1 instead of ~ISEMPTY(varargin). Also, in case no groups are not specified, the 'other piece of code' is used to avoid using FIND, which can be slow and would be useless in this case.

08 Dec 2008 MEX-files and MATLAB Compiler Basic instructions for calling external files and using the MATLAB compiler. Author: Douglas Dobbin

Excelent!

Comments and Ratings on Francisco's Files View all
Updated File Comment by Comments Rating
05 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro Komarov, Oleg

I appreciate the author's mind flexibility making this functions closer to the needs of the community.

05 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro Jos

It is nice to see some improvments Franciso! A couple of additional comments: if your sor worried about speed, I suggest you take a look at logical indexing, and replace all the zeros from the struct command by one call to zeros.

Another point: the behavior for 2D matrices should be explained, especially when the groups are specified. I think you did not intend that behavior. For instance, take a look if the following produces what you want them to produce:

A = rand(3,4) ; allstats(A), allstats(A,1:4), allstats(A,1:3)

With respect to the help, you can add examples of the expected output, besides giving only the calling syntax.

Below is the outline of a more optimized code:
function R = allstats(DATA, GROUP)
if isempty(ver('stats'))
    error('Function requires STATS toolbox.') ;
end
if nargin==1,
    GROUP = ones(numel(DATA),1) ;
    Ngroups = 1 ;
    UniqueGroups = 1 ;
else
    if numel(DATA) ~= numel(GROUP)
        error('Number of elements should match') ;
    end
    UniqueGroups = unique(GROUP) ;
    Ngroups = numel(UniqueGroups) ;
end
Z = nan(Ngroups,1) ;
R = struct('min',Z,'max',Z,'mean',Z) ; % etce
for k=1:Ngroups,
    Q = GROUP == UniqueGroups(k) ; % logical indexing
    R(k).min = nanmin(DATA(Q)) ;
    R(k).max = nanmax(DATA(Q)) ;
    R(k).mean = nanmean(DATA(Q)) ;
end

04 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro de Castro, Francisco

Tried to address the comments by Hanselman and Jos. The requirement of the Statistics TB is now shown. Help is (hopefully) less ambiguous. Some error checking is included, for numeric arguments and sizes of data and groups. By the way, examples WERE given from the beginning.

Grouping now works for the cases mentioned by Jos, i.e. the following cases all work:
allstats(rand(1,5),1:5)
allstats(rand(1,5),(1:5)')
allstats(rand(5,1),1:5)

Regarding Jos #2 comment: I don't see the advantage of using NARGIN > 1 instead of ~ISEMPTY(varargin). Also, in case no groups are not specified, the 'other piece of code' is used to avoid using FIND, which can be slow and would be useless in this case.

04 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro Jos

This submission can be improved considerably, considering the following:
1) when the data and group specification does not match, e.g., allstats([1 2 3],[1 2]), it should error
2) when the group data is not specified another piece of code is executed than when it is specified. Why not set the group data to all zeros, when no second argument is given. (and why not use nargin if the second argument is specified, instead of varargin)
3) Grouping does not work flawlessly: for instance ALLSTATS(rand(1,5),1:5) returns overall statistics, rather than statistics for the five individual groups
4) As Duane already mentioned, there should be reference, and some See Also's to the Stats TB and other functions

So, a lot to improve on this potential useful pick-of-the-week wrapper function.

03 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro Hanselman, Duane

This function calls functions that exist in the Statistics toolbox, but does not make that requirement known. No error checking is done. Help text is ambiguous and no examples are given. The last two help sentences describe unknown concepts that require more than a passing inspection of the function code to understand.

Top Tags Applied by Francisco
statistics, data exploration, mean, probability, 2d
Files Tagged by Francisco View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Nov 2009 Allstats Many statistics of a vector Author: Francisco de Castro kurtosis, minimum, quartile, maximum, skewness, mode 258 5
  • 3.5
3.5 | 2 ratings
29 Oct 2009 Screenshot Qplot Menu driven GUI for creating many graph types Author: Francisco de Castro correlation, qqplot, contour, normplot, surface, plot 357 5
  • 3.75
3.8 | 4 ratings
02 Sep 2009 ODE2STAB Integrates systems of differential equations until stability is reached (or time is over) Author: Francisco de Castro ode, stability, differential equation, ode solver, ode45 133 0
06 Aug 2009 Screenshot ANYRND Generates random numbers from an arbitrary user-defined frequency distribution Author: Francisco de Castro random number, statistics, frequency distributio... 133 0
12 Sep 2008 Screenshot Increase Image Resolution Increases the resolution of an image by interpolation Author: Francisco de Castro size, pixel, resolution, image, enhancement, pp 217 0
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com