sreg(x, y, lam=NA, offset=0, wt=rep(1, length(x)), cost=1, nstep.cv=50, maxit.cv=10, xgrid=sort(unique(x)), deriv=0, find.trA=T)
x
| Vector of x values |
y
| Vector of y values |
lam
| Smoothing parameter. If omitted this is estimated by GCV. |
offset
| GCV is RSS/((1-(tr(A)-offset)*cost + offset)/n)^2, so that the degrees of freedom can be adjusted with the offset. |
wt
| A vector that is proportional to the standard deviation of the errors. |
cost
| Cost value to be used in the GCV criterion. |
nstep.cv
| Number of grid points for minimum GCV search |
maxit.cv
| Maximum number of iterations for Golden Section search of optimum |
xgrid
| Vector of points to evaluate the estimated curve. Default is unique sorted x's. |
deriv
| If equal to 1 or 2 returns the estimated first or second derivative of the estimate. |
find.trA
| Calculate the trace of A |
The values of the estimated function at the data points can be expressed in the matrix form:
predicted.values= A(lambda)Y where A is an nXn symmetric matrix that does NOT depend on Y. The diagonal elements are the leverage values for the estimate and the sum of these (trace(A(lambda)) can be interpreted as the effective number of parameters that are used to define the spline function.
sreg(ozone$x[,1],ozone$y)-> fit # fit sreg to ozone at longitude values plot(fit) # plot sreg fit