get_landmarks: Extract the landmark coordinates from a Nystrom KRLS fit

View source: R/get_landmarks.R

get_landmarksR Documentation

Extract the landmark coordinates from a Nystrom KRLS fit

Description

Returns the landmark coordinate matrix used by an approx = "nystrom" fit. Landmarks are stored internally in the standardized X-space the model operates in; by default this accessor un-standardizes them so the returned matrix is in the original X units and can be passed back through krls(..., landmarks = ...) on a comparable dataset without a standardize-twice bug.

Usage

get_landmarks(fit, scale = c("original", "standardized"))

Arguments

fit

A fitted krls object built with approx = "nystrom".

scale

String selecting the coordinate system of the returned matrix. "original" (the default) un-standardizes the stored landmarks using the training data's column means and standard deviations. "standardized" returns the internally stored matrix unchanged.

Value

An m by D numeric matrix of landmark coordinates with column names inherited from fit$X.

Author(s)

Jens Hainmueller (Stanford) and Chad Hazlett (UCLA)

See Also

krls

Examples

## Not run: 
fit <- krls(X, y, approx = "nystrom", nystrom_m = 30)
Z   <- get_landmarks(fit)        # original-scale m x D matrix
# Reuse the same landmarks on a sensitivity-check refit with a new y:
fit2 <- krls(X, y_alt, approx = "nystrom", landmarks = Z)

## End(Not run)

KRLS documentation built on June 5, 2026, 9:06 a.m.