Last data update: 2014.03.03

R: True Squared Error LOSS of Shrinkage for a Simulated Response...
RXtsimuR Documentation

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 option 1 but re-express answers as in option 0.

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.)

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.

Value

An output list object of class RXtsimu:

form

The regression formula specified as the first argument.

data

Name of the data.frame object specified as the second argument.

trug

Vector of numerical values for the true uncorrelated gamma components.

trus

Numerical value for the true error standard deviation, Sigma.

qp

Numerical value of the Q-shape actually used for shrinkage.

p

Number of regression predictor variables.

n

Number of complete observations after removal of all missing values.

prinstat

Listing of principal statistics.

ydat

Matrix with simulated Y-responses in its first column and the true expected values of those responses in its second column.

coef

Matrix of shrinkage-ridge regression coefficient estimates.

rsel

Matrix of true relative SE losses in regression coefficient estimates.

spat

Matrix of shrinkage pattern multiplicative delta factors.

sext

Listing of summary statistics for all M-extents-of-shrinkage.

Author(s)

Bob Obenchain <wizbob@att.net>

See Also

RXridge and RXtrisk.

Examples

  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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RXshrink)
Loading required package: lars
Loaded lars 1.2

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RXshrink/RXtsimu.Rd_%03d_medium.png", width=480, height=480)
> ### Name: RXtsimu
> ### Title: True Squared Error LOSS of Shrinkage for a Simulated Response
> ###   Y-vector
> ### Aliases: RXtsimu
> ### Keywords: regression hplot
> 
> ### ** Examples
> 
>   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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>