Description Usage Arguments Value Note Author(s) See Also Examples
Create a response from a dataset and an equation.
1 2 3 4 5 6 7 8 9 10 11 | createResponse(data,
equation,
name = getEctdColName("Response"),
invLink,
distribution = "normal",
covariance,
errStruc = c("Additive", "Proportional", "Log-Normal"),
range,
digits = 3,
seed = .deriveFromMasterSeed(),
flagName = getEctdColName("RespOmit"))
|
data |
(Required) Data structure to which to add response. |
equation |
(Required) R function or character string for creating response. See
|
name |
(Optional) Response variable name ("RESP" by default) |
invLink |
(Optional) Inverse link function for the predictor. This is an R
|
distribution |
(Optional) Outcome variable distribution, one of "n" for normal, "l" for lognormal, "b" for binomial or "p" for poisson. Default is "Normal" |
covariance |
(Optional) Residual Error (CO)VARIANCE, passed to the
|
errStruc |
(Optional) Function describing how to apply residual error: "Additive", "Log-Normal" or "Proportional". "Additive" is the default |
range |
(Optional) Range of acceptable values for created response. See
|
digits |
(Optional) Number of digits to which to round the response (3 by default) |
seed |
(Optional) Random number seed. By default, this is derived from the current random seed |
flagName |
(Optional) "Response Omit" Flag name ("RESPOMIT" by default) |
A data set containing two columns.
RESP |
The actual Response |
RESPOMIT |
The response OMIT flag. It is named from the value of
the |
In earlier versions of MSToolkit, the "Proportional" Error Structure behaved differently (it is assumed parameters passed were on the log scale)
Mike K Smith mstoolkit@googlemail.com
The lower-level function of the response component:
createResponseVariable
and addResidualError
are called
by createResponse
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # example data
myData <- expand.grid( X = 1:2, Y = 1:2, Z = 1:2 )
# function example
out1 <- createResponse(data = myData, equation = function(data) with(data, X+Y+Z),
covariance = 1, range = "RESP < 3", seed = 96)
# same example using a character representation
out2 <- createResponse(data = myData, equation = "X+Y+Z",
covariance = 1, range = "RESP < 3", seed = 96)
stopifnot( identical( out1, out2) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.