osmultinom: Observation Specific Multinomial Log-linear Models

Description Usage Arguments Details Value References See Also Examples

Description

A localized version of multinomial regression.

Usage

1
2

Arguments

formula

A formula expression as for regression models, of the form response ~ predictors. The response should be a factor or a matrix with K columns. If censored = FALSE this is required to be a zero-one indicator matrix. A log-linear model is fitted, with coefficients zero for the first class. An offset can be included: it should be a numeric matrix with K columns if the response is either a matrix with K columns or a factor with K > 2 classes, or a numeric vector for a response factor with 2 levels. See the documentation of formula() for other details.

data

An optional data frame in which to interpret the variables occurring in formula.

subset

An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)

na.action

A function to specify the action to be taken if NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must be named.)

contrasts

A list of contrasts to be used for some or all of the factors appearing as variables in the model formula.

censored

Logical. If the response is a matrix with K > 2 classes, interpret the entries as one for possible classes, zero for impossible classes. Defaults to FALSE.

model

Logical. If TRUE, the model frame is saved as component model of the returned object.

...

Additional arguments for osnnet, including the window function and bandwidth parameters used to generate observation weights:

wf

A window function which is used to calculate weights that are introduced into the fitting process. Either a character string or a function, e.g. wf = function(x) exp(-x). For details see the documentation for wfs.

bw

(Required only if wf is a string.) The bandwidth parameter of the window function. (See wfs.)

k

(Required only if wf is a string.) The number of nearest neighbors of the decision boundary to be used in the fitting process. (See wfs.)

nn.only

(Required only if wf is a string indicating a window function with infinite support and if k is specified.) Should only the k nearest neighbors or all observations receive positive weights? (See wfs.)

itr

Number of iterations for model fitting, defaults to 3. See also the Details section.

Details

This is a localized version of multinomial regression where a multinomial regression model is fitted for each test observation based on the training data near the trial point. It is based on the function multinom from package nnet. osnnet is called internally.

In osmultinom no fitting is done. In the prediction step an individual model for every test observation is fitted. Observation weights that reflect the importance of training observations for the fit at a particular test observation are calculated internally in predict.osmultinom. For this reason not all types of response in formula are allowed and osmultinom does not take all arguments that can be passed to multinom. As response in formula factors and matrices are allowed. If censored = FALSE only zero-one class indicator matrices are allowed. Argument weights is missing since observation weights are calculated internally in predict.osmultinom. summ that specifies a method to summarize rows of the model matrix is missing since this requires adjustment of the case weights. Also Hess is not supported.

Value

An object of class osmultinom, inheriting from "osnnet", a list containing the following components:

x

A matrix containing the explanatory variables.

y

If argument y was a factor a class inicator matrix, otherwise a matrix that contains y unchanged.

...
mask

The mask vector used.

maxit

The maxit argument used.

trace

The trace argument used.

abstol

The abstol argument used.

reltol

The reltol argument used.

lev

If y is a factor the class labels (levels of y).

wf

The window function used. Always a function, even if the input was a string.

bw

(Only if wf is a string or was generated by means of one of the functions documented in wfs.) The bandwidth used, NULL if bw was not specified.

k

(Only if wf is a string or was generated by means of one of the functions documented in wfs.) The number of nearest neighbors used, NULL if k was not specified.

nn.only

(Logical. Only if wf is a string or was generated by means of one of the functions documented in wfs and if k was specified.) TRUE if only the k nearest neighbors recieve a positive weight, FALSE otherwise.

adaptive

(Logical.) TRUE if the bandwidth of wf is adaptive to the local density of data points, FALSE if the bandwidth is fixed.

variant

(Only if wf is a string or one of the window functions documented in wfs is used, for internal use only). An integer indicating which weighting scheme is implied by bw, k and nn.only.

call

The (matched) function call.

References

Czogiel, I., Luebke, K., Zentgraf, M. and Weihs, C. (2007), Localized linear discriminant analysis. In Decker, R. and Lenz, H.-J., editors, Advances in Data Analysis, volume 33 of Studies in Classification, Data Analysis, and Knowledge Organization, pages 133–140, Springer, Berlin Heidelberg.

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

predict.osmultinom, osnnet, nnet.

Other observation_specific multinom: predict.osmultinom

Examples

1
2
3
4
fit <- osmultinom(Species ~ Sepal.Length + Sepal.Width, data = iris,
    wf = "gaussian", bw = 0.5)
pred <- predict(fit)
mean(pred != iris$Species)

schiffner/locClass documentation built on May 29, 2019, 3:39 p.m.