Learn R Programming

RXshrink (version 1.0-7)

RXtsimu: True Squared Error LOSS of Shrinkage for a Simulated Response Y-vector

Description

By specifying numerical values for regression parameters (uncorrelated components and error sigma) that usually are unknown, these functions allow the user to simulate response data and display the True Squared Error Loss associated with shrinkage along a given Q-shaped path.

Usage

RXtsimu(form, data, trug, trus, Q = 0, rscale = 1, steps = 8, seed = 0123, qmax = 5, qmin = -5)

Arguments

form
A regression formula [y~x1+x2+...] suitable for use with lm().
data
Data frame containing observations on all variables in the formula.
trug
Column vector of numerical values for the true uncorrelated components of the regression coefficient vector.
trus
Numerical value for the true error standard deviation, Sigma.
Q
Numerical value for the shape parameter controling the shrinkage path curvature. Default shape is Q = 0 for Hoerl-Kennard "ordinary" ridge regression.
rscale
One of three possible choices (0, 1 or 2) for rescaling of variables as they are being "centered" to remove non-essential ill-conditioning: 0 implies no rescaling; 1 implies divide each variable by its standard error; 2 implies rescale as in
steps
Number of equally spaced values per unit change along the horizontal M-extent-of-shrinkage axis where estimates are calculated and displayed in TRACEs (default = 8.)
seed
Seed for random number generator. To get two different simulated response vectors and different sets of coefficients and SE losses, invoke the RXtsimu() function twice with different seed values. (default = 0123.)
qmax
Maximum allowed Q-shape (default = +5.)
qmin
Minimum allowed Q-shape (default = -5.)

Value

  • An output list object of class RXtsimu:
  • formThe regression formula specified as the first argument.
  • dataName of the data.frame object specified as the second argument.
  • trugVector of numerical values for the true uncorrelated gamma components.
  • trusNumerical value for the true error standard deviation, Sigma.
  • qpNumerical value of the Q-shape actually used for shrinkage.
  • pNumber of regression predictor variables.
  • nNumber of complete observations after removal of all missing values.
  • prinstatListing of principal statistics.
  • ydatMatrix with simulated Y-responses in its first column and the true expected values of those responses in its second column.
  • coefMatrix of shrinkage-ridge regression coefficient estimates.
  • rselMatrix of true relative SE losses in regression coefficient estimates.
  • spatMatrix of shrinkage pattern multiplicative delta factors.
  • sextListing of summary statistics for all M-extents-of-shrinkage.

Details

The RXridge() functions calculate maximum likelihood estimates (corrected, if necessary, so as to have correct range) for typical statistical inference situations where regression parameters are unknowns. In sharp contrast with this usual situation, the RXtsimu() functions show exactly how regression coefficient estimates and their true Squared Error Losses change with shrinkage for a simulated response Y-vector generated using given numerical values for regression parameters. In fact, it is interesting to compare the output from RXtrisk() and RXtsimu() for given regression parameters to the corresponding output from RXridge() on the data.frame in which any original response Y-vector has been replaced by the ydat object from the RXtsimu() output list.

See Also

RXridge and RXtrisk.

Examples

Run this code
data(haldport)
  form <- heat~p3ca+p3cs+p4caf+p2cs
  rxrobj <- RXridge(form, data=haldport)
  plot(rxrobj)
  # define true parameter values.
  trugam <- matrix(c(.8,.0,.3,.5),4,1)
  trusig <- 0.2
  # create true shrinkage MSE risk scenario.
  trumse <- RXtrisk(form, data=haldport, trugam, trusig, Q=-5)
  # calculate true shrinkage squared error losses.
  trusim <- RXtsimu(form, data=haldport, trugam, trusig, Q=-5)
  haldpsim <- haldport
  haldpsim[,5] <- trusim$ydat[,1]
  rxsobj <- RXridge(form, data=haldpsim) # analysis as if parameters unknown
  plot(rxsobj)

Run the code above in your browser using DataLab