ddesire {desire} R Documentation

## Generic Distribution functions for desirabilities

### Description

Generic density, distribution, quantile and random number generation functions for desirability functions.

### Usage

## Default S3 method:
ddesire(x, f, mean = 0, sd = 1)
## Default S3 method:
pdesire(q, f, mean = 0, sd = 1)
## Default S3 method:
qdesire(p, f, mean = 0, sd = 1)
## Default S3 method:
rdesire(n, f, mean = 0, sd = 1)
## Default S3 method:
edesire(f, mean, sd)
## Default S3 method:
vdesire(f, mean, sd)


### Arguments

 x,q Vector of quantiles. p vector of probabilies. n number of observations. f desirability function mean vector of means. sd vector of standard deviations.

### Value

'ddesire' gives the density, 'pdesire' gives the distribution function, 'qdesire' gives the quantile function, and 'rdesire' generates random deviates.

'edesire' and 'vdesire' return the expectation and variance of the function.

### Note

The default implementations for pdesire, qdesire, edesire and vdesire are only approximations obtained by estimating the desired property from a random sample.

### Author(s)

Heike Trautmann trautmann@statistik.tu-dortmund.de, Detlef Steuer steuer@hsu-hamburg.de and Olaf Mersmann olafm@statistik.tu-dortmund.de

For desirability functions: harrington1 and harrington2

### Examples

data(Chocolate)

## Fit linear model to data:
m.d90 <- lm(d90 ~ rt + as + I(rt^2) + I(as^2) + rt:as, Chocolate)
m.Fe <- lm(Fe ~ rt + as + I(rt^2) + I(as^2) + rt:as, Chocolate)

## Define desirability functions:
d.d90 <- harrington2(21, 22, 1)
d.Fe <- harrington1(22, 0.8, 28, 0.2)

## Plot density of desirability in rt=30, as=50:
df <- data.frame(rt=30, as=50)
y.Fe <- predict(m.Fe, df)
sigma.Fe <- summary(m.Fe)$sigma y.d90 <- predict(m.d90, df) sigma.d90 <- summary(m.d90)$sigma

## Plot curve of density function:
opar <- par(mfrow=c(2,1))
curve(ddesire(x, d.d90, y.d90, sigma.d90), 0, 1, main="d.90", n=202)
curve(ddesire(x, d.Fe, y.Fe, sigma.Fe), 0, 1, main="Fe", n=202)
par(opar)

## Integrate:
integrate(function(x) ddesire(x, d.d90, y.d90, sigma.d90), 0, 1)
integrate(function(x) ddesire(x, d.Fe, y.Fe, sigma.Fe), 0, 1)


[Package desire version 1.0.7 Index]