-
Notifications
You must be signed in to change notification settings - Fork 8
/
gcv.Krig.html
203 lines (166 loc) · 6.17 KB
/
gcv.Krig.html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Finds profile likelihood and GCV estimates of smoothing...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>
<table width="100%" summary="page for gcv.Krig {fields}"><tr><td>gcv.Krig {fields}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>Finds profile likelihood and GCV estimates of
smoothing parameters for splines and Kriging.</h2>
<h3>Description</h3>
<p>This is a secondary function that will use the computed Krig object and
find various estimates of the smoothing parameter lambda. These are
several different flavors of cross-validation, a moment matching
strategy and the profile likelihood. This function can also be used
independently with different data sets (the y's) if the covariates ( the
x's) are the same and thus reduce the computation.
</p>
<h3>Usage</h3>
<pre>
gcv.Krig(
out, lambda.grid = NA, cost = 1, nstep.cv = 200, rmse
= NA, verbose = FALSE, tol = 1e-05, offset = 0, y =
NULL, give.warnings = TRUE)
gcv.sreg (
out, lambda.grid = NA, cost = 1, nstep.cv = 80, rmse =
NA, offset = 0, trmin = NA, trmax = NA, verbose =
FALSE, tol = 1e-05, give.warnings = TRUE)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>out</code></td>
<td>
<p> A Krig or sreg object.</p>
</td></tr>
<tr valign="top"><td><code>lambda.grid</code></td>
<td>
<p> Grid of lambdas for coarse search. The default is
equally spaced on effective degree of freedom scale. </p>
</td></tr>
<tr valign="top"><td><code>cost</code></td>
<td>
<p> Cost used in GCV denominator </p>
</td></tr>
<tr valign="top"><td><code>nstep.cv</code></td>
<td>
<p> Number of grid points in coarse search. </p>
</td></tr>
<tr valign="top"><td><code>rmse</code></td>
<td>
<p> Target root mean squared error to match with
the estimate of sigma**2 </p>
</td></tr>
<tr valign="top"><td><code>verbose</code></td>
<td>
<p> If true prints intermediate results. </p>
</td></tr>
<tr valign="top"><td><code>tol</code></td>
<td>
<p> Tolerance in delcaring convergence of golden section search or bisection search. </p>
</td></tr>
<tr valign="top"><td><code>offset</code></td>
<td>
<p> Additional degrees of freedom to be added into the GCV denominator.
</p>
</td></tr>
<tr valign="top"><td><code>y</code></td>
<td>
<p>A new data vector to be used in place of the one associated with the
Krig object (obj) </p>
</td></tr>
<tr valign="top"><td><code>give.warnings</code></td>
<td>
<p> If FALSE will suppress warnings about grid search being out of
range for various estimates based on GCV and REML.</p>
</td></tr>
<tr valign="top"><td><code>trmin</code></td>
<td>
<p>Minimum value of lambda for grid search specified in terms
of effective degrees of freedom.</p>
</td></tr>
<tr valign="top"><td><code>trmax</code></td>
<td>
<p>Maximum value for grid search.</p>
</td></tr>
</table>
<h3>Details</h3>
<p>This function finds several estimates of the smoothing parameter using
first a coarse grid search followed by a refinement using a minimization (
in the case of GCV or maximum likelihood) or bisection in the case of
mathcing the rmse. Details of the estimators can be found in the help file
for the Krig function.
</p>
<p>The Krig object passed to this function has some matrix decompostions that
facilitate rapid computation of the GCV and ML functions and do not depend
on the independent variable. This makes it possible to compute the Krig
object once and to reuse the decompostions for multiple data sets. (But
keep in mind if the x values change then the object must be recalculated.)
The example below show show this can be used for a simulation study on the
variability for estimating the smoothing parameter.
</p>
<h3>Value</h3>
<p>A list giving a summary of estimates and diagonostic details with the
following components:
</p>
<table summary="R valueblock">
<tr valign="top"><td><code>gcv.grid </code></td>
<td>
<p> A matrix describing results of the
coarse search rows are values of lambda and the columns are
lambda= value of smoothing parameter,
trA=effective degrees of freedom,
GCV=Usual GCV criterion,
GCV.one=GCV criterion leave-one-out,
GCV.model= GCV based on average response in the case of replicates,
shat= Implied estimate of sigma ,
-Log Profile= negative log of profiel likelihood for the lambda.
</p>
</td></tr>
<tr valign="top"><td><code>lambda.est</code></td>
<td>
<p>Summary table of all estimates
Rows index different types of estimates:
GCV, GCV.model, GCV.one, RMSE, pure error, -Log Profile
and the columns are the estimated values for lambda, trA, GCV, shat.
</p>
</td></tr>
</table>
<h3>Author(s)</h3>
<p>Doug Nychka</p>
<h3>See Also</h3>
<p><code><a href="Krig.html">Krig</a></code>,
<code><a href="Tps.html">Tps</a></code>,
<code><a href="predict.Krig.html">predict.Krig</a></code> </p>
<h3>Examples</h3>
<pre>
#
Tps( ChicagoO3$x, ChicagoO3$y)-> obj # default is to find lambda by GCV
summary( obj)
gcv.Krig( obj)-> out
print( out$lambda.est) # results agree with Tps summary
sreg( rat.diet$t, rat.diet$trt)-> out
gcv.sreg( out, tol=1e-10) # higher tolerance search for minimum
## Not run:
# a simulation example
x<- seq( 0,1,,150)
f<- x**2*( 1-x)
f<- f/sqrt( var( f))
set.seed(123) # let's all use the same seed
sigma<- .1
y<- f + rnorm( 150)*sigma
Tps( x,y)-> obj # create Krig object
hold<- hold2<- matrix( NA, ncol=6, nrow=200)
for( k in 1:200){
# look at GCV estimates of lambda
# new data simulated
y<- f + rnorm(150)*sigma
# save GCV estimates
lambdaTable<- gcv.Krig(obj, y=y, give.warnings=FALSE)$lambda.est
hold[k,]<- lambdaTable[1,]
hold2[k,]<- lambdaTable[6,]
}
matplot( cbind(hold[,2], hold2[,2]),cbind( hold[,4],hold2[,4]),
xlab="estimated eff. df", ylab="sigma hat", pch=16, col=c("orange3", "green2"), type="p")
yline( sigma, col="grey", lwd=2)
## End(Not run)
</pre>
<hr /><div style="text-align: center;">[Package <em>fields</em> version 9.9 <a href="00Index.html">Index</a>]</div>
</body></html>