I want to estimate the parameters of a GEV (generalized extreme value) distribution using the method of weighted least squares. I use R, and I found a function called nls which I think might be used for this purpose. It asks for a formula and an optional dataset. I guess the GEV formula and annual maxima series should in here, but I am not sure how. Has anyone used nls and has any idea on how to do this?
#Vector of ranged annual maxima
x <- c(21,24,29,32,32,34,35,35,35,36,37,37,38,40,40,41,43,47,47,52)
w <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2)
data <- list(x=x,w=w)
nls(y ~ exp(-(1+((x-location)/scale))^(-1/shape)),data=data, weights=w,start=list(location=5,scale=2,shape=0.10))
The error says that y is missing. y is what we get when we optimize the GEV parameters, so that y becomes as close to x as possible for all x's (also depending on the weights). So y is unknown until we have estimated the GEV parameters...