sdcTools / sdcMicro

sdcMicro
http://sdctools.github.io/sdcMicro/
79 stars 23 forks source link

the transition matrix of PRAM #264

Closed orchardlucky closed 6 years ago

orchardlucky commented 6 years ago

The code is

res2 <- pram(testdata,variables=c("roof","walls","water"),
             pd=c(0.95,0.8,0.9), alpha=0.5)
attr(res2, "pram_params")$roof>

#> attr(res2, "pram_params")$roof
$Rs
            2          4            5           6            9
2 0.970396344 0.02728206 0.0006672392 0.001094932 0.0005594228
4 0.006006924 0.98859020 0.0016121788 0.002368318 0.0014223822
5 0.028585933 0.31369606 0.6519396872 0.004536487 0.0012418340
6 0.026213966 0.25751972 0.0025350956 0.711839660 0.0018915564
9 0.028460636 0.32865920 0.0014746779 0.004019557 0.6373859305

$pd
[1] 0.95

As I have set pd is equal to 0.95. Why are the diagonal entries of the transition matrix has values that are lesser than 0.95, such as 0.65, 0.71, 0.83.

[edit: fixed formatting]

bernhard-da commented 6 years ago

hi @orchardlucky

first of, you were trying this with a not-uptodate version of sdcMicro as your example fails because not all inputs are factors. but to answer your question: these kind of issues arise when factors have some levels that are very infrequent. in the given case, levels 5,6 and 9 of variable `roof have low frequencies which leads to the results you observed.

please note that it is possible to specify a custom transition matrix on your own, see the examples in ?pram.