简体   繁体   English

如何使用“maxlik”包估计广义指数函数的尺度和形状参数?

[英]How can I estimate scale and shape parameter of Generalized exponential function using 'maxlik' package?

I want to test the closeness of my sample data with the Generalized Exponential (GE) distribution.我想用广义指数 (GE) 分布测试我的样本数据的接近程度。 For that, I am using ks test in R. In the documentation of ks.gen.exp (reliaR package), its is given : ## Estimates of alpha & lambda using 'maxLik' package.为此,我在 R 中使用 ks 测试。在 ks.gen.exp(reliaR 包)的文档中,给出了:## 使用 'maxLik' 包对 alpha 和 lambda 的估计。 Example code from R package reliaR R 包 reliaR 中的示例代码

## Load data sets
data(bearings)
## Estimates of alpha & lambda using 'maxLik' package
## alpha.est = 5.28321139, lambda.est = 0.03229609
ks.gen.exp(bearings, 5.28321139, 0.03229609, alternative = "two.sided", plot = TRUE)

Can anyone tell me how to estimate alpha(shape parameter) and lambda(scale parameter) using maxLik package?谁能告诉我如何使用 maxLik 包估计 alpha(形状参数)和 lambda(比例参数)?

This is not the most elegant solution but following the examples found in ?maxLik , the code below is one such solution.这不是最优雅的解决方案,但按照?maxLik的示例,下面的代码就是这样的解决方案之一。 Note that the method "BFGS" may (not) be the best, but it reproduced the results of the example in ?ks.gen.exp .请注意,方法“BFGS”可能(不是)是最好的,但它复制了?ks.gen.exp示例的结果。

loglik.genExp <- function(theta){

    # Just incase you don't want to give the input names
    if(is.null(names(theta))){
        names(theta) <- c("alpha", "lambda")
    }

    # generate a numeric vector of probability densities from a general
    # exponential distribution
    rrgs <- c(list(x = z), as.list(theta))
    l    <- do.call("dgen.exp", rrgs)

    # return the log-likelihood
    sum(log(l))
}

# Assign your sample to the variable z
z <- bearings
maxLik(logLik = loglik.genExp, start = c(5.3, 0.03), method = "BFGS")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何估计伽马分布的形状和比例。 具有特定的均值和 95% 的分位数? - How can I estimate the shape and scale of a gamma dist. with a particular mean and a 95% quantile? 如何估计一系列线性段以拟合指数曲线? - how can I estimate a series of linear segments to fit an exponential curve? 如何用 R 估计指数 function 的参数? - How to estimate parameters of exponential function with R? 使用fitdist函数缩放比例和形状参数(fitdistrplus软件包) - Scaling for estimating scale and shape parameter with fitdist function (fitdistrplus package) 使用 package maxLik 的 BFGS 二元逻辑回归 - Binary Logistic Regression with BFGS using package maxLik 如何估计组中的功能? - How can I estimate a function in a group? 如何使用 maxLik package 计算 MLE - How to use the maxLik package to compute the MLEs 是否有一个R包具有data.frame的通用类,其中列可以是数组(或者我如何定义这样的类)? - Is there an R package with a generalized class of data.frame in which a column can be an array (or how do I define such a class)? 如何将 ntree 参数添加到插入符号 package 的 train() function 中? - How can I empose the ntree parameter into the train() function of caret package? 如何解决 R 中 x 的指数函数? - How can I resolve an exponential function for x in R?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM