Learn R Programming

rsm (version 1.13)

rsm: Response-surface regression

Description

Fit a linear model with a response-surface component, and produce appropriate analyses and summaries.

Usage

rsm (..., data)
## S3 method for class 'rsm':
summary(object, ...)
## S3 method for class 'summary.rsm':
print(x, ...)
loftest (object)

Arguments

...
In rsm, arguments that are passed to lm. The model must include an FO() or SO() term.to define the response-surface portion of the model. In summary
data
Optional data.frame as in lm. This could also be a coded.data object, in which case additional information is included in subsequent summaries.
object
An object of class rsm
x
An object produced by summary

Value

  • rsm returns an rsm object, which is a lm object with additional members as follows:
  • orderThe order of the model: 1 for first-order, 1.5 for first-order plus interactions, or 2 for a model that contains square terms.
  • bThe first-order response-surface coefficients.
  • BThe matrix of second-order response-surface coefficients, if present.
  • labelsLabels for the response-surface terms. These make the summary much more readable.
  • codingCoding formulas, if data is a coded.data object.
  • summary is the summary method for rsm objects. It returns an object of class summary.rsm, which is an extension of the summary.lm class with additional list elements:
  • saUnit-length vector of the path of steepest ascent (first-order models only).
  • canonicalCanonical analysis (second-order models only). This is a list with elements xs, the stationary point, and eigen, the eigenanalysis of B (see above).
  • lofANOVA table including lack-of-fit test.
  • codingCoding formulas in parent rsm object.
  • Its print method shows the regression summary, followed by an ANOVA and lack-of-fit test. For first-order models, it shows the direction of steepest ascent, and for second-order models, it shows the canonical analysis of the response surface. loftest returns an anova object that tests the fitted model against a model that interpolates the means of the response-surface-variable combinations.

Details

In rsm, the model formula must contain at least an FO term; optionally, you can add a TWI() term and/or a PQ() term as well (use the same variables in each!). For convenience, specifying SO() is the same as including FO(), TWI(), and PQ(), and is the safe, preferred way of specifying a full second-order model.

See Also

FO, SO, lm, summary, coded.data

Examples

Run this code
library(rsm)
CR = coded.data (ChemReact, x1~(Time-85)/5, x2~(Temp-175)/5)

### 1st-order model, using only the first block
CR.rs1 = rsm (Yield ~ FO(x1,x2), data=CR, subset=1:7) 
summary(CR.rs1)

### 2nd-order model, using both blocks
CR.rs2 = rsm (Yield ~ Block + SO(x1,x2), data=CR) 
summary(CR.rs2)

Run the code above in your browser using DataLab