2017-12-21 26 views
0

대칭 베타 분포 B (모양, 모양)을 기반으로 두 개의 매개 변수 shape1과 shape2가 동일한 맞춤 확률 밀도를 내 데이터에 맞추어야합니다. 문제는 일반 바닐라 대칭 베타 배포를 처리 할 때 몇 가지 문제가 발생한다는 것입니다. 게시물 끝에있는 코드를 고려하십시오. 코드에서 dbeta1은 shape1 = shape2 = shape에 대한 베타 분포 밀도입니다. 코드에서 dbeta2는 정규화 요소없이 명시 적으로 작성된 동일한 수량입니다 (수량 최대화에 관해서는 전혀 중요하지 않음).베타 분포 피팅 (R) - 다양한 시도

I는 (0.2, 0.2)을 베타에 따른 일부 난수를 생성하고, I는

MASS 1) fitdistr

2) MLE에서 stats4

결과를 이용하여 형상 파라미터를 추정하려고 : 일반적으로 말하자면 dbeta1 대신 dbeta2를 사용할 때 형상 매개 변수에 대한 비 견적 추정치가 있는데 그 이유를 이해하지 못합니다. 그런데, mle은 dbeta2와 충돌을 일으키고, 종종 난 x 난수 열의 시드에 따라 수치 문제가 있습니다.

나는 오해해야합니다. 그래서 어떤 제안이라도 인정됩니다.

library(MASS) 
library(stats4) 

dbeta1 <- function(x, shape, ...) 
    dbeta(x, shape, shape, ...) 

dbeta2 <- function(x, shape){ 
    res <- x^(shape-1)*(1-x)^(shape-1) 
    return(res) 
} 

LL1 <- function(shape){ 
    R <- dbeta1(x, shape) 
    res <- -sum(log(R)) 
    return(res) 
} 

LL2 <- function(shape){ 
    R <- dbeta2(x, shape) 
    res <- -sum(log(R)) 
    return(res) 
} 

set.seed(124) 
x <- rbeta(1000, 0.2, 0.2) 

fit_dbeta1 <- fitdistr(x , dbeta1, start=list(shape=0.5) ,  method="Brent", lower=c(0), upper=c(1)) 
print("estimate of shape from fit_dbeta1 is") 
print(fit_dbeta1$estimate) 

fit_dbeta2 <- fitdistr(x , dbeta2, start=list(shape=0.5) , method="Brent", lower=c(0), upper=c(1)) 
print("estimate of shape from fit_dbeta2 is") 
print(fit_dbeta2$estimate) 

fit_LL1 <- mle(LL1, start=list(shape=0.5)) 
print("estimate of from fit_LL1") 
print(summary(fit_LL1)) 

## this does not work 
fit_LL2 <- mle(LL2, start=list(shape=0.5)) 

답변

0

글쎄, 나는이 문제를 이해했다. dbeta2의 정규화 요소가 누락 된 것은 그 양이 모양에도 달려 있기 때문입니다. 내가

dbeta2 <- function(x, shape){ 


res <- x^(shape-1)*(1-x)^(shape-1)/beta(shape, shape) 

return(res) 

} 

를 사용하는 경우 다음 결과가 일치한다.