Dear R-help! I need to draw contour lines in a plot of wave heights (Hs) versus peak periods (Tp) showing the joint probabilities of 1-year wave heights~peak periods, 10-year wave heights~peak periods and 100-year wave heights~peak periods.
I've used the contourplot() function in the plot I've added in this mail. You can use the added dataset "Rhelpdata.txt" to reproduce a similar plot: D0=read.table("Rhelpdata.txt",header=TRUE) library(lattice) library(MASS) x=D0$totaltp y=D0$totalhm0 p1=1/(365*4) Ps=c(p1,p1/10,p1/100) contourplot(z~x+y,data=con2tr(kde2d(x,y,n=50)),xlim=c(0,32),ylim=c(0,16),xlab="Peak period (sec)",ylab="Significant wave height (m)",region=TRUE,fill=TRUE,at=Ps,labels=c("1yr","10yr","100yr")) My problem is that I wish for the contour lines to extend to non-observed return values. For ex. the 100-year value of wave heights is 15,5 m and 32,5 sec for peak periods. The contour lines are supposed to show "the worsed expected sea-state" in 1- 10- and 100-year periods. Is this possible to incorporate in the contourplot()-function? My guess is that to add these contour lines I have to calculate the joint distribution of the wave heights (Hs) and the peak periods (Tp), f(Hs,Tp), and then calculate the q-probability contour lines from this distribution. I know the distributions f(Hs) and f(Tp), which I have assumed to be generalized Pareto distributed as library(ismev) library(evd) Zh=5; Zt=10; Tppars=gpd.fit(x,Zt)$mle Hspars=gpd.fit(y,Zh)$mle and so the return values of each parameter separately are calculated as: yTp100=qgpd(1-p1/100,Zt,Tppars[1],Tppars[2]) yHp100=qgpd(1-p1/100,Zh,Hppars[1],Hppars[2]) My question are as followed: 1) Is there any function in R which can help me calculate a joint distribution when the separate distributions are known? or 2) Is there any way I can extend the contour lines in my plot to contain values of the worsed expected sea-state during 100-years? I am very grateful for reply! Regards Jorunn Slagstad
contour1.pdf
Description: Adobe PDF document
obs totalhm0 totaltp 73053 3.7 11.7 73054 3.4 11.5 73055 3.6 7.9 73056 3.9 8.9 73057 4.4 9.0 73058 4.5 9.6 73059 4.9 9.9 73060 5.5 10.6 73061 6.3 15.8 73062 6.2 16.2 73063 5.9 15.0 73064 5.7 14.0 73065 5.3 12.8 73066 5.5 14.5 73067 5.4 13.3 73068 5.1 12.8 73069 4.8 12.7 73070 4.6 11.7 73071 4.9 9.2 73072 4.8 10.1 73073 4.8 10.1 73074 4.6 9.4 73075 4.8 9.3 73076 5.5 10.0 73077 5.7 10.6 73078 4.9 10.9 73079 4.6 10.3 73080 4.0 9.7 73081 3.8 9.3 73082 3.9 11.2 73083 6.6 10.3 73084 5.7 11.2 73085 5.0 10.3 73086 5.0 10.1 73087 4.2 10.0 73088 3.7 8.7 73089 4.8 9.1 73090 6.0 10.3 73091 5.9 11.3 73092 4.9 10.5 73093 4.5 9.6 73094 3.8 9.1 73095 3.6 9.3 73096 5.1 9.1 73097 6.5 10.8 73098 8.6 12.0 73099 9.1 13.0 73100 9.1 13.3 73101 7.9 13.2 73102 6.4 12.8 73103 6.1 12.3 73104 5.9 13.0 73105 4.7 12.8 73106 4.1 11.7 73107 3.8 11.1 73108 3.5 11.0 73109 3.3 9.8 73110 3.4 8.1 73111 3.7 8.1 73112 4.0 8.9 73113 4.4 9.0 73114 4.5 9.2 73115 3.5 9.1 73116 4.0 8.8 73117 4.5 9.1 73118 3.7 9.5 73119 3.4 9.0 73120 3.3 8.8 73121 3.2 8.7 73122 3.1 15.4 73123 3.2 15.7 73124 3.4 16.4 73125 3.5 16.5 73126 3.8 15.9 73127 3.6 15.1 73128 3.7 7.1 73129 5.2 9.3 73130 7.7 11.8 73131 7.3 12.7 73132 5.7 11.6 73133 4.4 13.0 73134 4.5 13.1 73135 5.2 12.0 73136 6.0 12.1 73137 5.5 12.8 73138 4.7 11.5 73139 4.1 11.0 73140 3.8 10.7 73141 4.0 10.2 73142 4.6 10.4 73143 5.1 11.6 73144 5.4 12.0 73145 4.6 11.4 73146 3.9 10.9 73147 3.7 10.7 73148 3.3 10.3 73149 2.9 9.4 73150 2.6 9.0 73151 2.4 8.4 73152 2.1 8.3 73153 1.9 8.5 73154 1.9 8.6 73155 2.2 7.2 73156 2.2 13.2 73157 2.2 12.7 73158 2.6 12.3 73159 2.6 12.6 73160 3.2 9.0 73161 3.5 9.5 73162 3.5 11.2 73163 3.1 10.4 73164 2.7 9.8 73165 2.4 8.6 73166 2.2 8.0 73167 2.1 7.7 73168 2.3 7.7 73169 2.6 7.6 73170 3.2 8.3 73171 3.9 8.9 73172 4.9 9.6 73173 4.5 10.3 73174 3.7 13.3 73175 4.2 14.3 73176 4.9 14.5
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.