2009/02/19

Data Modeling

好文
如何建構與評估經濟理論模型

"1.經濟理論模型必須要有實證動機;2. 經濟理論模型必須能夠透過估計檢定或是模擬校準(calibra-
tion) 等方式, 評估該理論模型的良莠"


同樣的對於統計模型 DM modeling 也是吧

2009/02/18

Axis scaling algorithm

A good look axes scale usually increase by 10^(x) or 0.5*10^(x) according to the data's range. Dorothy E. Pugh provide an algorithm (and SAS Macro) for generated suitable axis scale, I modified the SAS code into R code
getAxisInterval <- function(x){
threshold <- c(3.162, 1.25, 1)
y <- range(x)
z <- format(diff(y), digits = 7, scientific = T)
tmp <- unlist(strsplit(z, "e"))
exppart <- as.numeric(tmp[2])
mantissa <- round(abs(as.numeric(tmp[1])), digit = 3)
intby <- switch(min(which(mantissa>=threshold, arr.ind = TRUE)), 10^exppart,
0.5*10^exppart, 10^(expart-1), 10^exppart)
#original limits
#tmp <- (0.5+0.01)*intby
#axislimit <- round(range(x) + c(-tmp, tmp), digit = -(exppart-1))
axislimit <- c(floor(y[1]/intby)*intby, ceiling(y[2]/intby)*intby)
return(list(axislimit = axislimit, stepBy = intby))
}
#for specified ticks location you can use
#ats <- seq(axislimit[1], axislimit[2], intby)
view raw axisScaling hosted with ❤ by GitHub


reference:Dorothy E. Pugh(SUGI25), "A Robust Generalized Axis-scaling Macro"

CC Copyright

創用 CC 授權條款
本著作由Chunhung Chou製作,以創用CC 姓名標示-相同方式分享 3.0 Unported 授權條款釋出。