Installing LOCFIT in S-Plus Versions 3.3, 3.4 (Unix)

Installation requires compiling the C code, and using dyn.load.shared(), dyn.load() or dyn.load2(), depending on what is supported on your system. As distributed, the installation files are set up to make a shared library, for use with dyn.load.shared().
  1. Save the locfit.shar file in a new locfit directory (if you are a site administrator, use
    $SHOME/library/locfit). Unpack the file with
    % sh locfit.shar
    

  2. If your SHOME is not /usr/splus (type Splus SHOME to be sure), you need to change SHOME at the top of Makefile.S3.

  3. Install with the command
    % sh install.S3
    

  4. (For HP systems) The shared library file will likely be called locfit.sl, rather than locfit.so, and you'll need to change Locfit's .First.lib() function. In Splus:
      > .First.lib() <- function(library, section)
      +    dyn.load.shared(paste(library, section, "locfit.sl", sep = "/"))
      

  5. (for Site Administrators) Add the line
    locfit        Local Regression, Likelihood and Density Estimation
    
    to the file $SHOME/library/README.

  6. (Optional; check locfit is working first!) Remove the source files. On your locfit installation directory, remove everything except the locfit.so file and the .Data subdirectory and contents.

  7. If you get 'unknown symbol gamma' or similar error message when trying to attach the locfit library, then you'll need to change the definition of the LGAMMA(arg) macro at the top of the file local.h. One of gamma(arg) or lgamma(arg) should be a suitable definition. Then, touch *.c and make again.

That's it! To access LOCFIT:

  1. If you run Splus from your locfit installation directory, use the command
    > dyn.load.shared("./locfit.so")
    

  2. If you run Splus from another directory, use
    > library("locfit",first=T,lib.loc=getenv("HOME"))
    
    Note the lib.loc argument should be the parent of your locfit directory; this can be omitted if you followed the Site Administrator installation.

If your system doesn't support shared libraries, but does support dyn.load() or dyn.load2(), edit Makefile.S3, and edit the WHICH_LOAD lines to

# WHICH_LOAD=static.load
WHICH_LOAD=dyn.load
# WHICH_LOAD=dyn.load.shared
Then run the install.S3 script. This should make the object file locfit_l.o. Run Splus, and change the .First.lib() function to
> .First.lib() <- function(library, section)
+    dyn.load2(paste(library, section, "locfit_l.o", sep = "/"))

If it still doesn't work, send me email.


Copyright © 1996-2000 Lucent Technologies, Bell Laboratories
Catherine Loader,
ccatherine@research.bell-labs.com

[LOCFIT home page]