Displaying 1 result from an estimated 1 matches for "dfwanted".
Did you mean:
alwanted
2009 Feb 01
0
possible memory leak involving looping, optimization, and gam
...Windows XP machine with R 2.6.1 (32-bit), nor on Mac OSX (Leopard) with R2.6.2.
mgcv versions are 1.4-1 for Linux and 1.3-29 for Windows and Mac.
n=700
x=runif(n)
dist=abs(matrix(x,n,n,byrow=TRUE)-matrix(x,n,n,byrow=FALSE))
Sigma=exp(-dist/0.3)
y=t(chol(Sigma))%*%rnorm(n)
psFun=function(spVal,dfWanted){
return((summary(gam(y~s(x,k=400),sp=spVal))$edf-dfWanted)^2)
}
for(i in 1:10000){
spVal=optimize(psFun,c(.00001,500),50)$minimum
print(i)
}
Note that the same issue seems to arise regardless of whether I use uniroot, optimize, nlminb, or nlm to do the optimization.
-chris
--------------...