MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Statistical packages

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Statistical packages
  • From: David Withoff <withoff>
  • Date: Tue, 29 Sep 1992 08:25:16 -0500

> In[1]:= <<Statistics`Master`
> 
> In[2]:= PDF[NormalDistribution[0,1],x]
>  
> PDF::shdw: Warning: Symbol PDF appears in multiple contexts
>     {Statistics`Common`DistributionsCommon`, Global`}; definitions in context
>     Statistics`Common`DistributionsCommon`
>      may shadow or be shadowed by other definitions.
>  
> Out[2]= PDF[NormalDistribution[0, 1], x]
>  
> What did go wrong?

This problem can be fixed by adding the following lines to
Statistics`Master`, which were missing in V2.0 :

DeclarePackage["Statistics`Common`DistributionsCommon`",
    {"CDF", "CharacteristicFunction", "Domain", "PDF", "QuantileQ"}]

or, in Mathematica :

In[2]:= << Statistics`Master`

In[3]:= DeclarePackage["Statistics`Common`DistributionsCommon`",
          {"CDF", "CharacteristicFunction", "Domain", "PDF", "QuantileQ"}]

Out[3]= Statistics`Common`DistributionsCommon`

In[4]:= PDF[NormalDistribution[0,1],x]

               1
Out[4]= ----------------
          2
         x /2
        E     Sqrt[2 Pi]

> In[1]:= !!alku.m
> <<Statistics`ContinuosDistributions`
> <<Statistics`NormalDistribution`
>  
> In[1]:= <<alku.m
>  
> SetDelayed::write:
>    Tag ChiSquareDistribution in Domain[ChiSquareDistribution[___]]
>      is Protected.
 
This is caused by effectively loading Statistics`NormalDistribution`
twice (it is included in Statistics`ContinuosDistributions`).
Special provisions must be made to allow these packages to be loaded
a second time without error.  Usually, these provisions consist of
unprotecting and clearing all of the symbols in the package.  The V2.0
statistics packages are not set up this way.

A common alternative is to use Needs[package] rather than Get[package]
(or <<package ).  Needs is much like Get except that Needs checks to see
if the context associated with the package is in the $Packages list
before loading the package, thereby avoiding loading a package that has
already been loaded.

Dave Withoff
withoff at wri.com





  • Prev by Date: Notebook for Newton's Method?
  • Next by Date: Re: Statistical packages
  • Previous by thread: Statistical packages
  • Next by thread: Re: Statistical packages