[R] distance from fitted line

eliza botto eliza_botto at hotmail.com
Sun Oct 19 22:05:02 CEST 2014


Dear useRs,
I have the following dataset.
> dput(EB)
c(77.724, 76.708, 84.836, 85.09, 118.11, 65.024, 121.412, 63.5, 102.87, 81.3, 108.7, 110.7, 71.9, 42.2, 101, 151.4, 94, 112, 48, 73.4, 76.6, 62.2, 59.4, 114.3, 214.3, 110.5, 46, 84.7, 128.1, 45.2, 109.5, 102.3, 77.5, 61, 97.3, 78, 142, 88.2, 54, 91.4, 54.1, 96, 143.3, 153.7, 101.5, 95.8, 101, 131, 140, 189.4)
I fitted generalized Extreme Value distribution on it by using following codes
library(nsRFA)
q=EB
lmom=Lmoments(q)
pr = par.GEV (lambda1=lmom["l1"], lambda2=lmom["l2"], tau3=lmom["lca"])
RP = c(1.01,2, 10, 20, 50, 100, 200, 500)
quant = invF.GEV (1-1/RP, pr$xi, pr$alfa, pr$k)
qs = sort(q)
pp = 1:length(qs)/(length(qs)+1)
RPpp = 1/(1-pp)
plot(RP, quant, type="l", log="x",col="black",ylim=c(0,500),xlim=c(0.1,500))
points(RPpp, qs)
What I want to do now is to calculate the distance of all the points from the "fitted line" and ultimately calculating RMSE of the data.
Is there a way of doing it?

Thankyou very much in advance

Eliza 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list