Sir, I want to solve the equation Q(u)=mean, where Q(u) represents the quantile function. Here my Q(u)=(c*u^lamda1)/((1-u)^lamda2), which is the quantile function of Davies (Power-pareto) distribution. Hence I want to solve , *(c*u^lamda1)/((1-u)^lamda2)=28353.7....(Eq.1)* where lamda1=0.03399381, lamda2=0.1074444 and c=26104.50. When I used the package 'Davies' and solved Eq 1, I got the answer u=0.3952365. But when I use the function 'uniroot' to solve the Eq.1, I got a different answer which is u=0.6048157. Why did this difference happen? Which is the correct method to solve Eq.1. Using the value of *u *from the first method my further calculation was nearer to empirical values. The R-code I used is herewith. Kindly help me to solve this issue. R-code Q(u)=(c*u^lamda1)/((1-u)^lamda2) mean=28353.7 # mean calculated from data lamda1=.03399381 # estimates c, lamda1 and lamda2 calculated from data lamda2=.1074444 c=26104.50 library(Davies)# using package params=c(c,lamda1,lamda2) u=pdavies(28353.7,params) u fun=function(u){((26104.50*u^0.03399381)/((1-u)^0.1074444))-28353.7} uniroot= uniroot(fun,c(0.01,1)) uniroot [[alternative HTML version deleted]]
Homework? On 2023-08-25 12:47, ASHLIN VARKEY wrote:> Sir, > I want to solve the equation Q(u)=mean, where Q(u) represents the quantile > function. Here my Q(u)=(c*u^lamda1)/((1-u)^lamda2), which is the quantile > function of Davies (Power-pareto) distribution. Hence I want to solve , > *(c*u^lamda1)/((1-u)^lamda2)=28353.7....(Eq.1)* > where lamda1=0.03399381, lamda2=0.1074444 and c=26104.50. When I used the > package 'Davies' and solved Eq 1, I got the answer u=0.3952365. But when I > use the function 'uniroot' to solve the Eq.1, I got a different answer > which is u=0.6048157. Why did this difference happen? Which is the > correct method to solve Eq.1. Using the value of *u *from the first method > my further calculation was nearer to empirical values. The R-code I used > is herewith. Kindly help me to solve this issue. > > R-code > Q(u)=(c*u^lamda1)/((1-u)^lamda2) > mean=28353.7 # mean calculated from data > lamda1=.03399381 # estimates c, lamda1 and lamda2 calculated from data > lamda2=.1074444 > c=26104.50 > library(Davies)# using package > params=c(c,lamda1,lamda2) > u=pdavies(28353.7,params) > u > fun=function(u){((26104.50*u^0.03399381)/((1-u)^0.1074444))-28353.7} > uniroot= uniroot(fun,c(0.01,1)) > uniroot > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
On Fri, 25 Aug 2023 22:17:05 +0530 ASHLIN VARKEY <ashlinvarkey at gmail.com> wrote:> Sir,Please note that r-help is a mailing list, not a knight! ??> I want to solve the equation Q(u)=mean, where Q(u) represents the > quantile function. Here my Q(u)=(c*u^lamda1)/((1-u)^lamda2), which is > the quantile function of Davies (Power-pareto) distribution. Hence I > want to solve , *(c*u^lamda1)/((1-u)^lamda2)=28353.7....(Eq.1)* > where lamda1=0.03399381, lamda2=0.1074444 and c=26104.50. When I used > the package 'Davies' and solved Eq 1, I got the answer u=0.3952365. > But when I use the function 'uniroot' to solve the Eq.1, I got a > different answer which is u=0.6048157. Why did this difference > happen? Which is the correct method to solve Eq.1. Using the value > of *u *from the first method my further calculation was nearer to > empirical values. The R-code I used is herewith. Kindly help me to > solve this issue. > > R-code > Q(u)=(c*u^lamda1)/((1-u)^lamda2) > mean=28353.7 # mean calculated from data > lamda1=.03399381 # estimates c, lamda1 and lamda2 calculated from data > lamda2=.1074444 > c=26104.50 > library(Davies)# using package > params=c(c,lamda1,lamda2) > u=pdavies(28353.7,params) > u > fun=function(u){((26104.50*u^0.03399381)/((1-u)^0.1074444))-28353.7} > uniroot= uniroot(fun,c(0.01,1)) > unirootAs Prof. Nash has pointed out, this looks like homework. Some general advice: graphics can be very revealing, and are easy to effect in R. Relevant method: plot.function(); relevant utility: abline(). Look at the help for these. cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619