我剛幫筆電換裝 SSD 裝 Dataram Ramdisk 之後遇到問題: Dropbox 老是無法啟動,一開始以為是 Ramdisk 或是 Dropbox 的 bug。
後來查閱討論串後發現,並非 Dropbox 或是 Ramdisk 寫不好有問題,而是 Dropbox 啟動需要暫存檔案的目錄確實存在,並非不支援 Ramdisk 的 TEMP 目錄,所以我們必須想辦法在 Ramdisk 啟動後立即產生一個 TEMP 目錄,這樣 Dropbox 就可以順利啟動。
我用的是 Dataram 這家公司的免費 Ramdisk ,剛好他的 Ramdisk 可以指名在生成 ramdisk 之後立刻自動產生一個 TEMP 目錄,把環境變數指過去就可以用了。
還發現一個有趣的事情,如果 TEMP 目錄不存在的話,連 Dataram ramdisk 都會啟動不了一直報錯喔!
參考:
https://forums.dropbox.com/topic.php?id=31624
2012年11月29日 星期四
2012年10月5日 星期五
HTC Desire Rooting
看了好多文章一頭霧水,終於還是把 HTC Desire 給成功 S-OFF 跟 Root,刷了第三方的 rom,這邊簡單做個紀錄。
我的 HTC Desire 是 SLCD 版本,2010/07 買的,有升級到官方最新版本 2.2。
我的 HTC Desire 是 SLCD 版本,2010/07 買的,有升級到官方最新版本 2.2。
- 首先要 S-OFF 跟 Root 。參考這篇文章,由 Revolutionary 原網頁下載必要工具。
- Revolutionary 的工具會問要不要順便刷 recovery,下載後就刷入。重新開機後 root-checker 確認已經是 root 狀態,在 bootloader 也呈現 S-OFF。
- 進 recovery 做備份到 microSD 卡上。步驟五裡面的 ext4 分區可以先做好,等下可以直接用。
- 更改 HBOOT 分區配置為 CM7r2。參考這裡。分區配置 img zip檔在這裡。
- 製作一張具有 ext4 分區的 microSD 卡。參考這篇文章,下載 Minitool Partition Wizard Home Edition。
- 重開機再刷入支援 CM7r2 分區的 rom。我選用 RSK Special Edition,參考這裡。
- 重開機安裝,一切 okay 的話就有一支新手機了!
標籤:
computer
2012年10月4日 星期四
紀錄一件事情
Способ 1. Заморозка триала:
StyleTap (Пост #15956983)
Способ 2. Сброс триала. Внимание! Удаляются все приложения, установленные в эмуляторе.
Триал сбрасывается очисткой данных программы!
В Rootexplorer идем по пути:
"data/data/com.StyleTap.StyleTap/files/"
Там ищем файл:
"msstcehcy2.dylib"
Убираем в разрешениях все галки на чтение.
Радуемся замерзшему триалу.
Из игр советую игру Void (элита).
Method 1. Freeze trial:
StyleTap (Post # 15956983)
Method 2. Reset Trial. Attention! Delete all the applications installed on the emulator.
Trial reset data cleaning program!
In Rootexplorer are on the way:
"data / data / com.StyleTap.StyleTap / files /"
There, look for a file:
"msstcehcy2.dylib"
We remove all the crows in the permits for reading.
Rejoice frozen trial.
Games advise game Void (elite).
標籤:
computer
2010年11月28日 星期日
aStat 實證醫學統計小工具介紹
(部份內容已先行發表於 mobile01.com)
前言
因為工作/研究上的需求,常常得算些二維列表的統計量,比如說: 卡方檢定,費雪精密檢定等。雖然已經有太多的軟體可以計算這些東西,但是很多資料我都是整理成乾淨的 excel 列表再使用樞紐分析表的功能去檢視變數之間的相關性,網路上工具一堆,可是上網有時也不是頂方便的。後來更因為要計算敏感度,特異性的信賴區間,以及 positive likelihood ratio (PLR) 等等,發現常用的 SPSS 並不提供比例或是 PLR 的信賴區間估計功能,按計算機或是用 excel 表又有點麻煩,因而萌生自己寫個小工具的念頭。
aStat 統計小工具 (A Statistical Calculator for Android) 就是這樣的狀況下的產物。
特點
1. 二維列連表 (2x2 contingency table) 的相關統計量計算,包括:
6. 設定顯示非零小數位數: 2-8 位數。
7. 除了提供一般教科書讓所使用的信賴區間估計法,另外還提供諸如 Agresti-Coull, Wilson, Newcombe 等人所提出的信賴區間方法,特別適用於小樣本數的狀況 (如: N < 40-50)。
8. 免費 (自由使用)
對象
研究人員,公衛/統計相關人員,實證醫學領域相關人士
當前版本
0.6
系統需求
Android 1.6 以上
近期計畫
1. Chi-square test for trend。之後應該暫時不會再更新。
中文介面的部份考量到詞彙的統一性,以及還在增加功能的過程,暫時還沒有做出來,還請見諒。
下載
您可以在 android market 搜尋關鍵字 aStat 就可以了,或是掃描以下的 QR code。

開發網頁
http://aStat.twbbs.org
展示圖片


結語
aStat並不同於一般 android market 上的統計工具,其目的並非要取代 PC 上的統計軟體,而是期待能提供一個快速,方便而準確的評估數據的方法。雖然是小眾市場,但是秉持著好東西要分享的精神,希望對您能有所幫忙! 若您覺得好用,請在 market 上給個好評吧! 此外,若您對區間估計的 algorithms 有興趣,程式碼亦可提供給您。目前所使用的機率分佈函式庫為 JSci,如果有人找到更小的歡迎再告訴我,謝謝!
致謝
1. Google。提供了這麼一個開放的平台,讓想像與時間是唯一的限制。
2. gasolin, 就是因為您的教材: 深入淺出 android ,讓非資訊相關產業的我有辦法完成這個小品!
3. 我們的研究團隊跟老闆。
前言
因為工作/研究上的需求,常常得算些二維列表的統計量,比如說: 卡方檢定,費雪精密檢定等。雖然已經有太多的軟體可以計算這些東西,但是很多資料我都是整理成乾淨的 excel 列表再使用樞紐分析表的功能去檢視變數之間的相關性,網路上工具一堆,可是上網有時也不是頂方便的。後來更因為要計算敏感度,特異性的信賴區間,以及 positive likelihood ratio (PLR) 等等,發現常用的 SPSS 並不提供比例或是 PLR 的信賴區間估計功能,按計算機或是用 excel 表又有點麻煩,因而萌生自己寫個小工具的念頭。
aStat 統計小工具 (A Statistical Calculator for Android) 就是這樣的狀況下的產物。
特點
1. 二維列連表 (2x2 contingency table) 的相關統計量計算,包括:
- 統計意義檢驗 (Test of significance): 卡方檢定 (Chi-square test), 連續性校正的卡方檢定 (Yate's corrected Chi-square test), 費雪精密檢定 (Fisher's exact test)
- 相關性強度檢驗 (Test of association): 勝算比 (odds ratio), 相對危險性 (risk ratio or relative risk), 危險差 (risk difference), 包含 95% 信賴區間的數值。
- 檢驗的正確性評價 (Evaluation of diagnostic power): 計算敏感度 (sensitivity), 特異性 (specificity), 陽性預測值 (PPV: positive predictive value), 陰性預測值 (negative predictive value), 陽性相似比 (positive likelihood ratio), 陰性相似比 (negative likelihood ratio), 亦包含 95% 信賴區間的數值。
- 比較不同的組別 (暴露 vs. 非暴露) 的 incidence rate 是不是有差?
- 計算 incidence rate ratio 以及 incidence rate difference
- 給定實驗組與對照組的 events rate (i.e., bad outcomes) 計算 absolute risk reduction/increase
- 提供 NNT/NNH 信賴區間 (Newcombe's method)
- 使用三個方法計算比例的信賴區間: exact method, Wilson's score method, Agresti-Coull method
6. 設定顯示非零小數位數: 2-8 位數。
7. 除了提供一般教科書讓所使用的信賴區間估計法,另外還提供諸如 Agresti-Coull, Wilson, Newcombe 等人所提出的信賴區間方法,特別適用於小樣本數的狀況 (如: N < 40-50)。
8. 免費 (自由使用)
對象
研究人員,公衛/統計相關人員,實證醫學領域相關人士
當前版本
0.6
系統需求
Android 1.6 以上
近期計畫
1. Chi-square test for trend。之後應該暫時不會再更新。
中文介面的部份考量到詞彙的統一性,以及還在增加功能的過程,暫時還沒有做出來,還請見諒。
下載
您可以在 android market 搜尋關鍵字 aStat 就可以了,或是掃描以下的 QR code。

開發網頁
http://aStat.twbbs.org
展示圖片


結語
aStat並不同於一般 android market 上的統計工具,其目的並非要取代 PC 上的統計軟體,而是期待能提供一個快速,方便而準確的評估數據的方法。雖然是小眾市場,但是秉持著好東西要分享的精神,希望對您能有所幫忙! 若您覺得好用,請在 market 上給個好評吧! 此外,若您對區間估計的 algorithms 有興趣,程式碼亦可提供給您。目前所使用的機率分佈函式庫為 JSci,如果有人找到更小的歡迎再告訴我,謝謝!
致謝
1. Google。提供了這麼一個開放的平台,讓想像與時間是唯一的限制。
2. gasolin, 就是因為您的教材: 深入淺出 android ,讓非資訊相關產業的我有辦法完成這個小品!
3. 我們的研究團隊跟老闆。
2010年8月2日 星期一
可轉債自動報價查詢 II
可轉債, CB, 自動化查詢, 股票, 金融
改進了之前的 script ,全部改成 python 來寫。可由標準輸入檔案讀入想查詢的台灣股市上市上櫃公司代號,完畢後輸出成 html table 並發信至指定的電郵信箱。
usage:
python thisscript.py < stocklist.txt
這支 script 基本上做了下面的事情:
1. 依代號查網頁 (tw.stock.yahoo.com)
2. 解析網頁資料
3. 輸出成 html table
4. 寄信 with attachment
#! /usr/bin/env python
# -*- coding: big5 -*-
import urllib2, re, sys, csv
import smtplib
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email import encoders
from email.utils import COMMASPACE
html = '<html><table border="1" style="border-collapse:collapse;" borderColor=black>\n'
html = html + '<tr><th>代碼</th><th>HTTP</th><th>名稱</th><th>成交價</th><th>漲跌</th><th>買進</th><th>賣出</th>'
html = html + '<th>張數</th><th>昨收</th><th>開盤</th><th>最高</th><th>最低</th></tr>\n'
data = []
for line in sys.stdin:
F1, F2, F3, F4, F5 = '', '', '', '', ''
F1 = re.match('\d+', line).group(0)
url = 'http://tw.stock.yahoo.com/q/q?s=' + F1
myrequest = urllib2.Request(url)
myrequest.add_header('User-Agent', 'Mozilla 5.0')
try:
content = urllib2.urlopen(myrequest)
F2 = 'OK'
except:
F2 = 'Failed'
c = content.read()
m = re.search(r'href="/q/bc\?s=\d+">(\d+.*?)</a>', c)
F3 = m.group(1) if m else '-'
m = re.search(r'nowrap><b>(\d+.?\d+|\d+|-)</b></td>', c)
F4 = m.group(1) if m else '-'
m = re.search(r'nowrap><font color=#......>(▽\d+.\d+|△\d+.\d+|\d+.\d+|-)', c)
F5 = m.group(1) if m else '-'
F6 = re.findall(r'wrap>(\d+.?\d+|\d+|-)</td>', c)
data.append([F1, F2, F3, F4, F5]+F6[1:])
for line in sorted(data, key=lambda x: float(x[3]) if (x[3] <> '-') else x[3]):
result = ''
for x in line:
result = result + x + ','
result = re.sub(',' , '</td><td>', result)
result = '<tr><th>'+result+'</tr>\n'
result = re.sub(r'<th>(\d+)</td>', r'<th>\1</th>', result)
html = html + result
html = html + '</table></html>\n'
tt = datetime.now().timetuple()
me = "sender@email.address"
you = ['recipient1@email.address', 'recipient2@email.address']
# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = "CB Report " + str(tt[0]) + "-" + str(tt[1]) + "-" + str(tt[2]) + " " + str(tt[3]) + ":" + str(tt[4]) + ":" + str(tt[5])
msg['From'] = me
msg['To'] = COMMASPACE.join(you)
# Create the body of the message (a plain-text and an HTML version).
# text = """ <html><b>test</b></html> """
# html = """ this is html data """
# Record the MIME types of both parts - text/plain and text/html.
# part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html', _charset='Big5') # _charset is important to avoid bad characters
# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
#msg.attach(part1)
msg.attach(part2)
# Send the message via local SMTP server.
s = smtplib.SMTP('localhost')
# sendmail function takes 3 arguments: sender's address, recipient's address
# and message to send - here it is sent as one string.
s.sendmail(me, you, msg.as_string())
s.quit()
2010年7月21日 星期三
可轉債自動報價查詢
關鍵字: perl, python, 可轉債 (convertible bond)
上市公司及上櫃公司的可轉債約有200多卷,可由公開資訊觀測站查詢相關的訊息。以可轉債的特性而言,比較有用的是跌到票面價格以下的債卷,但必須要常常追蹤價格以及市場消息,對於非專業人士實在力有未逮。如果要一筆一筆輸入 Yahoo 的投資組合來 monitor,也是耗時又費力。因此在一台 linux 上面寫了個 perl 的查詢器,再放到 crontab 來定時自動查詢,方便性增加不少。在這邊做個紀錄。
下面是一開始用的 perl script,可以用標準輸入讀入可轉債代號文字檔案 (一個代號一列),查詢後輸出到標準輸出 (csv tab 分隔文字格式)。以下的方法也可以用來查詢一般的股票。
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
$ua = new LWP::UserAgent; # 產生 UserAgent 物件
my $year = (localtime)[5] + 1900; # year
my $month = (localtime)[4] + 1; # month
my $day = (localtime)[3]; # day
my $date = $year."-".$month."-".$day;
print "代碼"."\t"."HTTP"."\t"."名稱"."\t"."成交價"."\n";
foreach (<>) {
chomp($_);
$request = new HTTP::Request('GET', 'http://tw.stock.yahoo.com/q/q?s='.$_); # 產生 Request 物件
$response = $ua->request($request); # 開始抓取網頁,並將結果傳會 $response
if ($response->is_success) { # 若抓取網頁成功,則印出 HTML 原始碼
my $html = $response->content;
if ($html =~ m{href="/q/bc\?s=\d+">(\d+.*?|-)}) {
print $_."\tOK\t".$1."\t";}
else {print $_."\tOK\t"."抓不到\t";}
if ($html =~ m{nowrap>(\d+.?\d+)}) {
print $1."\n";}
else {print "抓不到\n";}
} else { # 若抓取網頁不成功,則印出錯誤訊息
#print $response->error_as_HTML;
print $_."\t"."網頁讀取有問題"."\n";
}
}
配合上 crontab 執行以下的 perl script 可以固定每天定時查詢後發信至指定的信箱,包括日期跟時間
#!/usr/bin/perl -w
my $year = (localtime)[5] + 1900; # year
my $month = (localtime)[4] + 1; # month
my $day = (localtime)[3]; # day
my $hour = (localtime)[2]; # hour
my $minute = (localtime)[1]; # minute
my $second = (localtime)[0]; # second
my $cbdate = $year."-".$month."-".$day." ".$hour.":".$minute.":".$second;
my $output = "/tmp/"."cblist-".$year."-".$month."-".$day."-".$hour."-".$minute."-".$second.".txt";
`/path-to-script/queryscript.pl < /convertible_bond_list.txt > $output`;
sleep(25);
open IN, ("< $output");
$to='your@email.address';
$from= 'your@email.address';
$subject='CB Report '.$cbdate;
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
foreach () {
print MAIL $_;
}
close(MAIL);
查完後發現還是不夠完美,我希望可以針對成交價由小至大做排序,這樣只要看前面的幾個可轉債就好了,所以把查詢的 script 用 python 來改寫,輸出 csv 逗號分隔檔至標準輸出裝置,另外增加了 yahoo 上可查詢到的其他欄位。
#! /usr/bin/env python
# -*- coding: big5 -*-
import urllib2, re, sys, csv
print '代碼,HTTP,名稱,成交價,漲跌,買進,賣出,張數,昨收,開盤,最高,最低'
data = []
for line in sys.stdin:
F1, F2, F3, F4, F5 = '', '', '', '', ''
F1 = re.match('\d+', line).group(0)
url = 'http://tw.stock.yahoo.com/q/q?s=' + F1
myrequest = urllib2.Request(url)
myrequest.add_header('User-Agent', 'Mozilla 5.0')
try:
content = urllib2.urlopen(myrequest)
F2 = 'OK'
except:
F2 = 'Failed'
c = content.read()
m = re.search(r'href="/q/bc\?s=\d+">(\d+.*?)', c)
F3 = m.group(1) if m else '-'
m = re.search(r'nowrap>(\d+.?\d+|\d+|-)', c)
F4 = m.group(1) if m else '-'
m = re.search(r'nowrap>(▽\d+.\d+|△\d+.\d+|\d+.\d+|-)', c)
F5 = m.group(1) if m else '-'
F6 = re.findall(r'wrap>(\d+.?\d+|\d+|-)', c)
data.append([F1, F2, F3, F4, F5]+F6[1:])
for line in sorted(data, key=lambda x: float(x[3]) if (x[3] <> '-') else x[3]):
result = ''
for x in line:
result = result + x + ','
print result[:-1]
這個 script 有幾個問題
1. 在比大小的時候,python 內建的排序遇到浮點數會被當成字串,因為一開始我們查詢回來的資料就是字串,因此比大小的時候要 type casting。
2. 有用到 key,所以必須要用 python2.4 以上。
上市公司及上櫃公司的可轉債約有200多卷,可由公開資訊觀測站查詢相關的訊息。以可轉債的特性而言,比較有用的是跌到票面價格以下的債卷,但必須要常常追蹤價格以及市場消息,對於非專業人士實在力有未逮。如果要一筆一筆輸入 Yahoo 的投資組合來 monitor,也是耗時又費力。因此在一台 linux 上面寫了個 perl 的查詢器,再放到 crontab 來定時自動查詢,方便性增加不少。在這邊做個紀錄。
下面是一開始用的 perl script,可以用標準輸入讀入可轉債代號文字檔案 (一個代號一列),查詢後輸出到標準輸出 (csv tab 分隔文字格式)。以下的方法也可以用來查詢一般的股票。
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
$ua = new LWP::UserAgent; # 產生 UserAgent 物件
my $year = (localtime)[5] + 1900; # year
my $month = (localtime)[4] + 1; # month
my $day = (localtime)[3]; # day
my $date = $year."-".$month."-".$day;
print "代碼"."\t"."HTTP"."\t"."名稱"."\t"."成交價"."\n";
foreach (<>) {
chomp($_);
$request = new HTTP::Request('GET', 'http://tw.stock.yahoo.com/q/q?s='.$_); # 產生 Request 物件
$response = $ua->request($request); # 開始抓取網頁,並將結果傳會 $response
if ($response->is_success) { # 若抓取網頁成功,則印出 HTML 原始碼
my $html = $response->content;
if ($html =~ m{href="/q/bc\?s=\d+">(\d+.*?|-)}) {
print $_."\tOK\t".$1."\t";}
else {print $_."\tOK\t"."抓不到\t";}
if ($html =~ m{nowrap>(\d+.?\d+)}) {
print $1."\n";}
else {print "抓不到\n";}
} else { # 若抓取網頁不成功,則印出錯誤訊息
#print $response->error_as_HTML;
print $_."\t"."網頁讀取有問題"."\n";
}
}
配合上 crontab 執行以下的 perl script 可以固定每天定時查詢後發信至指定的信箱,包括日期跟時間
#!/usr/bin/perl -w
my $year = (localtime)[5] + 1900; # year
my $month = (localtime)[4] + 1; # month
my $day = (localtime)[3]; # day
my $hour = (localtime)[2]; # hour
my $minute = (localtime)[1]; # minute
my $second = (localtime)[0]; # second
my $cbdate = $year."-".$month."-".$day." ".$hour.":".$minute.":".$second;
my $output = "/tmp/"."cblist-".$year."-".$month."-".$day."-".$hour."-".$minute."-".$second.".txt";
`/path-to-script/queryscript.pl < /convertible_bond_list.txt > $output`;
sleep(25);
open IN, ("< $output");
$to='your@email.address';
$from= 'your@email.address';
$subject='CB Report '.$cbdate;
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
foreach (
print MAIL $_;
}
close(MAIL);
查完後發現還是不夠完美,我希望可以針對成交價由小至大做排序,這樣只要看前面的幾個可轉債就好了,所以把查詢的 script 用 python 來改寫,輸出 csv 逗號分隔檔至標準輸出裝置,另外增加了 yahoo 上可查詢到的其他欄位。
#! /usr/bin/env python
# -*- coding: big5 -*-
import urllib2, re, sys, csv
print '代碼,HTTP,名稱,成交價,漲跌,買進,賣出,張數,昨收,開盤,最高,最低'
data = []
for line in sys.stdin:
F1, F2, F3, F4, F5 = '', '', '', '', ''
F1 = re.match('\d+', line).group(0)
url = 'http://tw.stock.yahoo.com/q/q?s=' + F1
myrequest = urllib2.Request(url)
myrequest.add_header('User-Agent', 'Mozilla 5.0')
try:
content = urllib2.urlopen(myrequest)
F2 = 'OK'
except:
F2 = 'Failed'
c = content.read()
m = re.search(r'href="/q/bc\?s=\d+">(\d+.*?)', c)
F3 = m.group(1) if m else '-'
m = re.search(r'nowrap>(\d+.?\d+|\d+|-)', c)
F4 = m.group(1) if m else '-'
m = re.search(r'nowrap>(▽\d+.\d+|△\d+.\d+|\d+.\d+|-)', c)
F5 = m.group(1) if m else '-'
F6 = re.findall(r'wrap>(\d+.?\d+|\d+|-)', c)
data.append([F1, F2, F3, F4, F5]+F6[1:])
for line in sorted(data, key=lambda x: float(x[3]) if (x[3] <> '-') else x[3]):
result = ''
for x in line:
result = result + x + ','
print result[:-1]
這個 script 有幾個問題
1. 在比大小的時候,python 內建的排序遇到浮點數會被當成字串,因為一開始我們查詢回來的資料就是字串,因此比大小的時候要 type casting。
2. 有用到 key,所以必須要用 python2.4 以上。
2010年1月1日 星期五
2009年9月30日 星期三
布瓦松分佈與區間估計 (Poisson Distribution and Estimation of Confidence Interval)
Poisson Distribution 可視為二項式分佈 (Binomial Distribution) 的極限情形。亦即,當試驗次數 (n) 趨近無窮大,p 很小,但一段時間裏面 np 為一不大不小的定值時。從品質管理的角度,如:每日不良產品的數目,不良事件的發生數目等等,每週醫療照顧相關感染的發生次數等等,皆適用於布瓦松分佈。[1]
依從 Poisson 分布的群體,最佳的點估計即為平均值 u。當我們只做了一個單次的觀察,可利用卡方分佈 (Chi square Distribution) 與 Poisson 分布的關係,很快的求出對應的 95% 信賴區間估計 (exact confidence interval)。[2-4]
令 x 為單次的觀察結果 (發生次數),InvChiSqare (v,y) 函數代表自由度 v 的 Chi Sqare 分布下面積為 y 的機率分布對應的 Chi Sqare 值。則依從 Poisson 分布的 95 % 信賴區間上下限 (exact confidence interval; UL; LL) 與卡方分布有如下的關係:
LL = 1/2 * InvChiSqare (2x, 0.025)
UL = 1/2 * InvChiSqare (2x + 2, 0.975)
當觀察次數不止一次時 (observations = N),所有的觀察次數合 (n) 依從 Poisson 分布。其 95% 信賴區間上下限可如此表示:[5]
LL = 1/2 * InvChiSqare (2n, 0.025) / N
UL = 1/2 * InvChiSqare (2n + 2, 0.975) / N
References:
依從 Poisson 分布的群體,最佳的點估計即為平均值 u。當我們只做了一個單次的觀察,可利用卡方分佈 (Chi square Distribution) 與 Poisson 分布的關係,很快的求出對應的 95% 信賴區間估計 (exact confidence interval)。[2-4]
令 x 為單次的觀察結果 (發生次數),InvChiSqare (v,y) 函數代表自由度 v 的 Chi Sqare 分布下面積為 y 的機率分布對應的 Chi Sqare 值。則依從 Poisson 分布的 95 % 信賴區間上下限 (exact confidence interval; UL; LL) 與卡方分布有如下的關係:
LL = 1/2 * InvChiSqare (2x, 0.025)
UL = 1/2 * InvChiSqare (2x + 2, 0.975)
當觀察次數不止一次時 (observations = N),所有的觀察次數合 (n) 依從 Poisson 分布。其 95% 信賴區間上下限可如此表示:[5]
LL = 1/2 * InvChiSqare (2n, 0.025) / N
UL = 1/2 * InvChiSqare (2n + 2, 0.975) / N
References:
- Poisson 分布. Available at: http://episte.math.ntu.edu.tw/articles/sm/sm_16_07_1/index.html [Accessed Sep 30, 2009]
- Confidence intervals for the mean of a Poisson distribution. Available at: http://www.math.mcmaster.ca/peter/s743/poissonalpha.html [Accessed Sep 30, 2009]
- Poisson confidence interval. Available at: http://www.statsdirect.com/help/parametric_methods/pest.htm [Accessed Sep 30, 2009]
- An exact method for calculating a confidence interval of a poisson parameter. Mulder et al. American Journal of Epidemiology 117 (3): 337. Available at: http://aje.oxfordjournals.org/cgi/pdf_extract/117/3/377 [Accessed Sept 30, 2009]
- Estimating the mean of a Poisson population. Chapter 6.3. Available at Google Books [Accessed Sep 30, 2009]
2009年7月3日 星期五
2009年2月15日 星期日
2009年1月5日 星期一
GDIPLUS.DLL dependency of AdvStringGrid
This is an excerpt from the website of TMS Component suite
---
Q22: Users of older operating systems have an error message on application startup related to a missing gdiplus.dll
A22: Either redistribute the Microsoft GDIPLUS.DLL (explained in README.TXT) or remove the gdiplus.dll dependency by commenting the line {$DEFINE TMSGDIPLUS} in TMSDEFS.INC
---
Q22: Users of older operating systems have an error message on application startup related to a missing gdiplus.dll
A22: Either redistribute the Microsoft GDIPLUS.DLL (explained in README.TXT) or remove the gdiplus.dll dependency by commenting the line {$DEFINE TMSGDIPLUS} in TMSDEFS.INC
標籤:
computer
2008年12月29日 星期一
2008年9月28日 星期日
2008年7月28日 星期一
2008年7月6日 星期日
2008年7月1日 星期二
新玩具 - JVC GZ-MG275
NT$ 21,000 at Nova, Taipei
Standard equip. with a second Li-ion battery, a photo bag, one UV len, and one cleaning set.
Refer to Mobile01.com 的開箱文
People said there:
....
這台會高光溢出...(????)
如果錄影時,太亮或太暗,可使用
1.背光補償 功能
2.單點曝光 功能
3.調整快門速度
4.調整光圈比例
最大光圈F1.2
1/3.9CCD感光元件、10倍光學變焦。採用JVC獨家研發晶片 ,影像清晰又銳利,在黯暗的環境下也能拍攝出清晰的畫面喔。最大光圈F1.2,比一般F1.8明亮約2倍,室內拍攝最佳幫手
2008/07/03 補充
發現 JVC 拍出來的檔案格式為 .mod, google 後發現這個格式以 16:9 拍攝後在 xp 下直接播放竟會變成 4:3 格式! 必須再轉檔, 或使用 sdcopy 工具處理.
參考
Standard equip. with a second Li-ion battery, a photo bag, one UV len, and one cleaning set.
Refer to Mobile01.com 的開箱文
People said there:
....
這台會高光溢出...(????)
如果錄影時,太亮或太暗,可使用
1.背光補償 功能
2.單點曝光 功能
3.調整快門速度
4.調整光圈比例
最大光圈F1.2
1/3.9CCD感光元件、10倍光學變焦。採用JVC獨家研發晶片 ,影像清晰又銳利,在黯暗的環境下也能拍攝出清晰的畫面喔。最大光圈F1.2,比一般F1.8明亮約2倍,室內拍攝最佳幫手
2008/07/03 補充
發現 JVC 拍出來的檔案格式為 .mod, google 後發現這個格式以 16:9 拍攝後在 xp 下直接播放竟會變成 4:3 格式! 必須再轉檔, 或使用 sdcopy 工具處理.
參考
2008年6月22日 星期日
更改圖檔名稱工具 - Tools for modifying filenames with the datetime of the images
經過一段時間的尋找與試用, 有以下的幾個選擇:
Image Renaming
- 優點: 可以簡單的選擇多轉換的日期格式
- 缺點: 要安裝 .Net 2.0 Framework, 轉換檔名的速度有點慢
XnView
- 優點: 功能強大, 連 mp3 都可以轉, 非常多樣的檔名版型組合
- 缺點: 要花一點時間找一下轉檔名的功能表單
Siren
- 優點: 支源音樂檔圖檔, 專門的改檔名免費工具
- 缺點:
標籤:
computer
2008年6月13日 星期五
eth0 problems
Keywords: fixed IP, eth0, network config, runlevel
After B2D linux (B2D pureKGB 20080513) was installed, eth0 was not up automatically during booting up. I do not know exactly the reason causing this. However, the problem could be solved by setting the networking service manually.
bash#cd /etc/rc5.d/
bash#ln -s ../init.d/networking S16networking
After B2D linux (B2D pureKGB 20080513) was installed, eth0 was not up automatically during booting up. I do not know exactly the reason causing this. However, the problem could be solved by setting the networking service manually.
bash#cd /etc/rc5.d/
bash#ln -s ../init.d/networking S16networking
標籤:
computer
2008年6月11日 星期三
Install PIL (Python Image Library) at Bluehost.com
I tried to install PIL1.1.6 at Bluehost and encoutered the following error messages:
to the following
With this, PIL would not be compiled with tkinter support.
The problem can be corrected by not importing tkinter. Modify the program block of the file "setup.py"
bash#python setup.py install --prefix=$HOME
......
......
_imagingtk.c:20:16: tk.h: No such file or directory
_imagingtk.c:23: error: syntax error before '*' token
_imagingtk.c:31: error: syntax error before "Tcl_Interp"
_imagingtk.c:31: warning: no semicolon at end of struct or union
_imagingtk.c:32: warning: data definition has no type or storage class
_imagingtk.c: In function `_tkinit':
_imagingtk.c:37: error: `Tcl_Interp' undeclared (first use in this function)
_imagingtk.c:37: error: (Each undeclared identifier is reported only once
_imagingtk.c:37: error: for each function it appears in.)
_imagingtk.c:37: error: `interp' undeclared (first use in this function)
_imagingtk.c:45: error: syntax error before ')' token
_imagingtk.c:50: error: `app' undeclared (first use in this function)
_imagingtk.c:50: error: syntax error before ')' token
_imagingtk.c: At top level:
_imagingtk.c:55: warning: parameter names (without types) in function declaration
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: warning: data definition has no type or storage class
_imagingtk.c:57: error: syntax error before '&' token
error: command 'gcc' failed with exit status 1
try:
import _tkinter
except ImportError:
_tkinter = None
to the following
_tkinter = None
With this, PIL would not be compiled with tkinter support.
訂閱:
文章 (Atom)