Skip to main content

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I
I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15 (b~93 and q~1.7). Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

My data = c(28.744, 385.714, 20.595, 99.350,31.864, 77.713, 264.408, 21.204, 31.937, 0.900, 18.762, 173.276, 23.707) 
 
constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximumres$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15 (b~93 and q~1.7). Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution.
I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15 (b~93 and q~1.7). Finally, I would also like to do the same but using the SSQ method instead of MLE?

My data = c(28.744, 385.714, 20.595, 99.350,31.864, 77.713, 264.408, 21.204, 31.937, 0.900, 18.762, 173.276, 23.707) 
 
constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```
added 17 characters in body
Source Link
Tom
  • 41
  • 3

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15 (b~93 and q~1.7). Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15. Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15 (b~93 and q~1.7). Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```
added 408 characters in body
Source Link
Tom
  • 41
  • 3

I would like to fit a gamma/weibull/pareto distributionThis code was kindly recommended to a data set of valuesme in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to produce a CDFreplicate it for the Weibull distribution. I knowwas wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I can do this using the fitdist function butwould expect a shape of ~0.59 and scale of ~55.15. Finally, I would also like to forcedo the distribution through a given value at a specified percentile to shapesame but using the tailSSQ method instead of the data. Is this possibleMLE? More information: My Thanks! My data:28 = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707. I also have an additional value of 500.612 which is at the 95th percentile. I know this is a 'bad' way to fit a graph but we need this constraint to shape the tale of the fit. So I would like to fit a gamma distribution to this dataset but the gamma curve must reach 500.612 at the 95th percentile Thanks!)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```

I would like to fit a gamma/weibull/pareto distribution to a data set of values to produce a CDF. I know I can do this using the fitdist function but I would also like to force the distribution through a given value at a specified percentile to shape the tail of the data. Is this possible? More information: My data:28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707. I also have an additional value of 500.612 which is at the 95th percentile. I know this is a 'bad' way to fit a graph but we need this constraint to shape the tale of the fit. So I would like to fit a gamma distribution to this dataset but the gamma curve must reach 500.612 at the 95th percentile Thanks!

This code was kindly recommended to me in my original question. It returned the same parameter estimates as the software called CRAFT by Aon Benfield. I have also managed to replicate it for the Weibull distribution. I was wondering if anyone could help me replicate if for Pareto? Based on CRAFT, I would expect a shape of ~0.59 and scale of ~55.15. Finally, I would also like to do the same but using the SSQ method instead of MLE? Thanks! My data = 28.744,385.714,20.595,99.350,31.864,77.713,264.408,21.204,31.937,0.900,18.762,173.276,23.707)

constrained_mle <- function(x, p, q) {
  lnL <- function(shape) {
    # Solving q = qgamma(p, shape)*scale for the necssary scale
    scale <- q/qgamma(p, shape)
    sum(dgamma(x, shape, scale=scale, log=TRUE))
  }
  res <- optimise(lnL, lower=0, upper=1e+3, maximum=TRUE, tol=1e-8)
  scale <- q/qgamma(p, res$maximum)
  c(scale=scale, shape=res$maximum)
}
par <- constrained_mle(x, .95, 500.912)
par
#>       scale       shape 
#> 231.0561574   0.6038756
# checking that the solution is correct
qgamma(.95, scale=par[1], shape=par[2])
#> [1] 500.912 ```
Became Hot Network Question
Post Reopened by Jarle Tufto, whuber
Post Closed as "Needs details or clarity" by Xi'an, mdewey, User1865345
added 426 characters in body
Source Link
Tom
  • 41
  • 3
Loading
Source Link
Tom
  • 41
  • 3
Loading