Description Usage Arguments Value Author(s) References Examples
Estimate variance using Gasser, Sroka, and Jennen-Steinmetz, 1986
1 | estimateSigmaSq(explanatory, response)
|
explanatory |
Explanatory sample points |
response |
Observed responses at the explanatory sample points |
Returns a list consisting of
sigmaSq |
Estimate of variance |
a |
coefficients of the estimator |
b |
coefficients of the estimator |
eps |
coefficients of the estimator |
Shawn Mankad
Gasser T, Sroka L, Jennen-Steinmetz C (1986). 'Residual variance and residual pattern in nonlinear regression.' Biometrika, 73(3), 625-633. ISSN 0006-3444.
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 | explanatory = runif(50)
response = explanatory^2 + rnorm(50, sd=0.1)
estimateSigmaSq(explanatory, response)
## The function is currently defined as
function (explanatory, response)
{
ind = order(explanatory, decreasing = FALSE)
if (sum(diff(ind) < 0) != 0) {
explanatory = explanatory[ind]
response = response[ind]
}
n = length(response)
a = b = eps = rep(0, n - 2)
for (i in 2:(n - 1)) {
x = explanatory[(i - 1):(i + 1)]
a[i - 1] = (x[3] - x[2])/(x[3] - x[1])
b[i - 1] = (x[2] - x[1])/(x[3] - x[1])
eps[i - 1] = a[i - 1] * response[i - 1] + b[i - 1] *
response[i + 1] - response[i]
}
cSq = 1/(a^2 + b^2 + 1)
list(sigmaSq = 1/(n - 2) * sum(cSq * eps^2), a = a, b = b,
eps = eps)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.