morals function

Multiple Regression (MORALS).

Multiple Regression (MORALS).

Fits multiple regression within the Gifi framework.

morals(x, y, xknots = knotsGifi(x, "Q"), yknots = knotsGifi(y, "Q"), xdegrees = 2, ydegrees = 2, xordinal = TRUE, yordinal = TRUE, xties = "s", yties = "s", xmissing = "m", ymissing = "m", xactive = TRUE, xcopies = 1, itmax = 1000, eps = 1e-6, verbose = FALSE)

Arguments

  • x: Vector or data frame with predictor variables (all numeric)
  • y: Vector with response variable
  • xknots: Knots specification for predictors (see knotsGifi)
  • yknots: Knots specification for response (see knotsGifi)
  • xdegrees: Degree specification for predictors
  • ydegrees: Degree specification for response
  • xordinal: Whether predictors should be considered as ordinal or not. Alternatively, one can specify a boolean vector of length m denoting which variables should be ordinally restricted or not
  • yordinal: Whether response should be considered as ordinal or not
  • xties: How predictor ties should be handled: primary ("p"), secondary ("s"), or tertiary ("t")
  • yties: How response ties should be handled: primary ("p"), secondary ("s"), or tertiary ("t")
  • xmissing: How missing predictor values should be handled: multiple ("m"), single ("s"), or average ("a")
  • ymissing: How missing response values should be handled: multiple ("m"), single ("s"), or average ("a")
  • xactive: Which predictors should be active or inactive
  • xcopies: Number of copies for each predictor
  • itmax: Maximum number of iterations
  • eps: Convergence criterion
  • verbose: Iteration printout

Details

Fits MORALS as described in De Leeuw et al. (2017).

Returns

  • rhat: Induced correlation matrix

  • objectscores: Object scores (rows)

  • xhat: Optimally transformed predictors

  • yhat: Optimally transformed response

  • ypred: Predicted (fitted) values

  • yres: Residuals

  • smc: Squared multiple correlation

  • ntel: Number of iterations

  • f: Loss function value

References

Gifi, A. (1990). Nonlinear Multivariate Analysis. New York: Wiley.

De Leeuw, J., Mair, P., Groenen, P. J. F. (2017). Multivariate Analysis with Optimal Scaling.

See Also

homals, princals, plot.morals

Examples

x <- scale(as.matrix(seq(0, pi, length = 20)), scale = FALSE) y <- scale(as.matrix(sin(x)), scale = FALSE) fitxy <- morals(x, y, xknots = knotsGifi(x, "E"), xdegrees = 2) plot(fitxy, main = c("x", "y")) plot(fitxy, plot.type = "resplot") plot(fitxy$xhat, fitxy$yhat) lines(fitxy$xhat, fitxy$ypred) plot(x, fitxy$yhat) lines(x, fitxy$ypred)