get.smart {VGAM} | R Documentation

## Retrieve One Component of “.smart.prediction”

### Description

Retrieve one component of the list `.smart.prediction` from `smartpredenv` (R) or frame 1 (S-PLUS).

### Usage

    get.smart()

### Details

`get.smart` is used in `"read"` mode within a smart function: it retrieves parameters saved at the time of fitting, and is used for prediction. `get.smart` is only used in smart functions such as `poly`; `get.smart.prediction` is only used in modelling functions such as `lm` and `glm`. The function `get.smart` gets only a part of `.smart.prediction` whereas `get.smart.prediction` gets the entire `.smart.prediction`.

### Value

Returns with one list component of `.smart.prediction` from `smartpredenv` (R) or frame 1 (S-PLUS), in fact, `.smart.prediction[[.smart.prediction.counter]]`. The whole procedure mimics a first-in first-out stack (better known as a queue).

### Side Effects

The variable `.smart.prediction.counter` in `smartpredenv` (R) or frame 1 (S-PLUS) is incremented beforehand, and then written back to `smartpredenv` (R) or frame 1 (S-PLUS).

### See Also

`get.smart.prediction`.

### Examples

    "my1" <- function(x, minx=min(x)) { # Here is a smart function
        x <- x  # Needed for nested calls, e.g., bs(scale(x))
        if(smart.mode.is("read")) {
            smart  <- get.smart()
            minx <- smart$minx          # Overwrite its value
        } else
        if(smart.mode.is("write"))
            put.smart(list(minx=minx))
        sqrt(x-minx)
    }
    attr(my1, "smart") <- TRUE

[Package VGAM version 0.7-9 Index]