Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/getoptimalalpha.R
To calculate the optiomal smoothing alpha if it si not specified.
1 | getoptimalalpha(formula, data, plotit = F)
|
formula |
Formula to do the regression. |
data |
A data frame of n rows by 2 columns. The column names should agree with the variable names specified in the formula. |
plotit |
Whether plot will be geneated to show how the different choices of alpha will affect the generalized cross validation values. |
When this routine is invoked, it will fit a sereies regressions specified by the formula on data set. For each one, the generalized cross validation will be calculated and the "best" (minimal) GCV will be found with the corresponding alpha returned.
A numeric value of alpha value will be returned.
Zhongfa Zhang, Jiayang Sun
Zhongfa Zhang, et al: Test Equality of Curves with Homoscedastic or Heteroscedastic Errors. To appear
curvefit, curvetest.
1 2 3 4 |
x1=seq(0,1, length=n1<-50); f1<-function(x){x*(1-x)+sin(2*pi*x)};
y1=f1(x1)+rnorm(n1, 0, 0.2)
getoptimalalpha(formula=y~x, data.frame(x=x1, y=y1), plotit = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.