好文
如何建構與評估經濟理論模型
"1.經濟理論模型必須要有實證動機;2. 經濟理論模型必須能夠透過估計檢定或是模擬校準(calibra-
tion) 等方式, 評估該理論模型的良莠"
同樣的對於統計模型 DM modeling 也是吧
2009/02/19
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
reference:Dorothy E. Pugh(SUGI25), "A Robust Generalized Axis-scaling Macro"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
reference:Dorothy E. Pugh(SUGI25), "A Robust Generalized Axis-scaling Macro"
訂閱:
文章 (Atom)