aboutsummaryrefslogtreecommitdiff
path: root/man/inverse.predict.Rd
blob: 8c2be9c6db1cab4335212d2c6fdece3e91b1d676 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
\name{inverse.predict}
\alias{inverse.predict}
\alias{inverse.predict.lm}
\alias{inverse.predict.rlm}
\alias{inverse.predict.default}
\title{Predict x from y for a linear calibration}
\usage{inverse.predict(object, newdata, \dots,
  ws, alpha=0.05, ss = "auto")
}
\arguments{
  \item{object}{
    A univariate model object of class \code{\link{lm}} or 
    \code{\link[MASS:rlm]{rlm}} 
    with model formula \code{y ~ x} or \code{y ~ x - 1}.
  }
  \item{newdata}{ 
    A vector of observed y values for one sample.
  }
  \item{\dots}{
    Placeholder for further arguments that might be needed by 
    future implementations.
  }
  \item{ws}{ 
    The weight attributed to the sample. The default is to take the 
    mean of the weights in the model, if there are any.
  }
  \item{alpha}{
    The error tolerance level for the confidence interval to be reported.
  }
  \item{ss}{
    The estimated standard error of the sample measurements. The 
    default is to take the residual standard error from the calibration.
  }
}
\value{
  A list containing the predicted x value, its standard error and a
  confidence interval.
}
\description{
  This function predicts x values using a univariate linear model that has been
  generated for the purpose of calibrating a measurement method. Prediction
  intervals are given at the specified confidence level.
  The calculation method was taken from Massart et al. (1997). In particular,
  Equations 8.26 and 8.28 were combined in order to yield a general treatment
  of inverse prediction for univariate linear models, taking into account 
  weights that have been used to create the linear model, and at the same
  time providing the possibility to specify a precision in sample measurements
  differing from the precision in standard samples used for the calibration.
  This is elaborated in the package vignette.
}
\note{
  The function was validated with examples 7 and 8 from Massart et al. (1997).
}
\references{
  Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J.,
  Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A,
  p. 200
}
\examples{
data(massart97ex3)
attach(massart97ex3)
yx <- split(y,factor(x))
s <- round(sapply(yx,sd),digits=2)
w <- round(1/(s^2),digits=3)
weights <- w[factor(x)]
m <- lm(y ~ x,w=weights)

inverse.predict(m,15,ws = 1.67)
}
\keyword{manip}

Contact - Imprint