要在 ubuntu 10.04 下的 gretl cvs 變成可 commit 修改 .PO 檔,不能用 gretl 手冊中所寫的下這兩行指令
cvs -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl login
(不必輸入,直接按空間棒)
cvs -z3 -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl co -P gretl
我在 ubuntu 11.04 下實測 (參考:CVS#Read-Write access),先下指令
export CVS_RSH=ssh
cvs -z3 -d:ext:xxi-xxxx@xxx.cvs.sourceforge.net:/cvsroot/gretl checkout gretl
(輸入帳密就 OK 了)
./configure 後說少了 libcurl 和 gtksourceview2.0, 又裝了以下
sudo apt-get install libcurl4-openssl-dev libgtksourceview2.0-dev
再下指令
(如果已下載更新多次, 可能要再下指令
make clean)
./configure
make
sudo make install
sudo cp /usr/local/lib/libgretl* /usr/lib
這樣就 OK 了
搭配 Cervisa + POedit 就可以正常地更新新的 zh_TW.po 檔
2013年4月18日
2012年9月1日
在 ubuntu 11.04 全新自行 compile 安裝 gretl 1.9.9 cvs
1. 從 gretl 網站抓最近原始碼 (不一定是 1.9.9版)
先建一個子目錄, 例如 cvs, 進入後, 先下指令, 抓原始碼cvs -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl login問密碼不用輸入, 直接按 [enter], 再輸入
cvs -z3 -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl co -P gretl
如此會產生 ./cvs/gretl 子目錄, 以後更新原始碼時, 用以下指令就會自動更新了
cvs update -d -P
2. 編輯前設定 config
先切換到 gretl 原始碼的目錄, 例如你剛剛是下載到 ./cvs/gretlcd ./cvs/gretl ./configure如果出現錯誤, 應該是需要的套件沒裝,依 gretl 原始套件的說明檔 README.packages 所述, 安裝以下套件
3. 安裝 gretl 所需套件 (dependences)
sudo apt-get install gnuplot libfftw3-dev liblapack-dev gfortran libxml2 \ zlib1g-dev libreadline5-dev libgtksourceview2.0-dev libgmp3-dev libcurl3-dev想要自行 make pdfdocs 還要下載安裝
sudo apt-get install texlive texlive-latex-extra libxslt1-dev
4. 再重新編輯
./configure make sudo make install這樣應該 OK 了!
覺得麻煩的話, 下載我 compile 好的 deb: gretl_1.9.9-1_amd64.deb
2011年8月7日
用 PPA 安裝 gnuplot for gretl under ubuntu 10.04
gnuplot 4.2 不 “完全” 相容於 gretl 的問題, 有更簡單的解決辦法了, 就是改用 ppa, update 後自動安裝, 不需要自行 compile 了 (自行 compile gnuplot 的方法,見我之前寫的 http://yinung2.blogspot.com/search/label/gnuplot)
gnuplot 4.2 in default ubuntu 10.04 does not well support gretl. Gretl needs at least 4.4 to work normally.
You may use this ppa instead for the current version of gnuplot.
sudo add-apt-repository ppa:daniel-elstner/ppa
gnuplot 4.2 in default ubuntu 10.04 does not well support gretl. Gretl needs at least 4.4 to work normally.
You may use this ppa instead for the current version of gnuplot.
sudo add-apt-repository ppa:daniel-elstner/ppa
sudo apt-get update
Then upgrade your gnuplot to 4.4.
see also https://launchpad.net/~daniel-elstner/+archive/ppa
2011年7月21日
在 ubuntu 11.04 裝 自行打包的 gretl 1.9.5
我成功地在 ubuntu 11.04 裝 自行打包的 gretl 1.9.5
1. 先依 “在 ubuntu 中 compile gretl 1.9.2” 這篇來下載 gretl-1. 9.5.tar.bz2
2. 解壓縮到 (例如: /home/xxx/gretl/cvs/gretl) 後, 再於終端機中下指令:
cd /home/xxx/gretl/cvs/gretl
sudo apt-get build-dep gretl
./configure
make
sudo make install
sudo cp /usr/local/lib/libgretl* /usr/lib
3. 最後,於終端機中下指令 gretl, 就完成了
就連 gnuplot 也成功地換成 4.2 以後的版本,這樣 gretl 跑起來,畫圖中的中文就正常了
1. 先依 “在 ubuntu 中 compile gretl 1.9.2” 這篇來下載 gretl-1.
2. 解壓縮到 (例如: /home/xxx/gretl/cvs/gretl) 後, 再於終端機中下指令:
cd /home/xxx/gretl/cvs/gretl
sudo apt-get build-dep gretl
./configure
make
sudo make install
sudo cp /usr/local/lib/libgretl* /usr/lib
3. 最後,於終端機中下指令 gretl, 就完成了
就連 gnuplot 也成功地換成 4.2 以後的版本,這樣 gretl 跑起來,畫圖中的中文就正常了
2011年3月21日
在 ubuntu 中 compile gretl 1.9.2
這是在 gretl-users mail list 中有人提及的方法 (還沒試過, 再找時間一試), 我以前的自行編譯 (compile) 的經驗是有很多 dependencies 的問題, 不知道以下的方法, 能否更簡單地 compile gretl
Uninstall gretl 1.8.7 and I compile the program directly from the
source.
It works. I also have Ubuntu 10.04.
Download the 1.9.2 version from:
http://prdownloads.sourceforge.net/gretl/gretl-1. 9.2.tar.bz2
Unpack. Open a terminal and write:
cd [directory where is the gretl source]
sudo apt-get build-dep gretl
./configure
make
sudo make install
That's all
You can launch the program from the terminal or create an icon in the
menu.
2011年3月5日
2011年1月7日
在 ubuntu 10.04 安裝 gretl 1.9.3x - 有關 gnuplot 的問題
用 gnuplot for gretl 的方法, 但是有錯誤(在執行 gnuplot 時):
XXX@ubu1004:/$ /opt/gnuplot/bin/gnuplot
/opt/gnuplot/bin/gnuplot: error while loading shared libraries: libwx_gtk2u_richtext-2.8.so.0: cannot open shared object file: No such file or directory
找了很多方法, 都不能決解,
後來乾脆直接下載
gnuplot (4.4.0-1) (for maverick ) 的 binary 檔來試試@ http://packages.ubuntu.com/maverick/gnuplot
但要先安裝
gnuplot-nox (>= 4.4.0-1)
gnuplot-x11 (>= 4.4.0-1)
裝好以後 gnuplot 的部份應該OK了 (可以在終端機中打 gnuplot, 看版本是不是 4.4)
接著安裝我自已打包的 gretl_1.9.3-1_i386.deb
安裝好 gretl 之後, 依 在 ubuntu 9.10 裝 自行打包的 gretl 1.8.6 這篇的說明:
- 1. 在 /usr/local/lib 下, 找到 libgretl-1.0.so.0 和其它 3 個以 libgretl* 開始的檔案, 都複製到 /usr/lib
- 2. 找不到 lapack.so.0 ...
/usr/local/bin/gretl_x11: error while loading shared libraries: liblapack.so.3: cannot open shared object file: No such file or directory
- 3. 還欠 libg2c.so.0
直接將 libg2c.s0.0.0 下載至 /usr/lib, 再用 link 騙過去
2010年7月3日
試用 ubuntu 10.04
今天用 virtualbox 3.1.2 在 ubuntu 9.10 下試用 ubuntu 10.4 版, 結果 ubuntu 10.04 系統開啟地很慢很慢...
後來將 virtualbox 換成 3.2.6 版, 問題才解決
ubuntu 10.04 視窗風格有很大的改變, 最不適應的是放大縮小鈕改成放在左上角 ...
要更改為放在右上角的話:
- 在終端機啟動 gconf-editor
- 點選 Apps > Metacity > General > Button Layout
- 把字串值改成:menu:minimize,maximize,close
(原來的值是: close,minimize,maximize:)
ubuntu 10.04 這一版的預設中文輸入法仍是 iBus + 注音輸入法, 新增倉頡 3 代後, 發現輸入法會記住你上一次所挑選的字, 總算有些進步...
ubuntu 10.04 這一版預載可安裝的 gretl 是 1.8.7
測試的 gretl script
open djclose
smpl 1988/01/04 1989/12/29
gf1 <- gnuplot djclose --time-series --output=display --with-lines
gf1.show
先裝上 gretl 1.8.7 之後, 再
從 https://sites.google.com/site/gretlforubuntu/home/gretl-deb 下載自行編譯的 gretl 1.9.1, 但無法執行:
/usr/local/bin/gretl_x11/: error while loading shared libraries: liblapack.so.
用
sudo aptitude install libfftw3-dev
sudo aptitude install liblapack-dev
之後再重裝 gretl 1.9.1 即可 (比上一版 9.10 的簡單一些)
最後, 固定寛度字形預設是 monospace, 但要改成 freemono, 或 Courier 10 pitch 顯示才會對齊...
若執行 ARIMA 模型估計時, 出現 /usr/lib/gretl-gtk2/arma.so 找不到, 則建立連結:
sudo ln -s /usr/local/lib/gretl-gtk2/ /usr/lib/gretl-gtk2/
2010年1月23日
安裝 (非 compile) gretl 1.8.6 - 1.8.7 on ubuntu 8.04
先下載 我自行打包的 gretl-1.8.6 for ubuntu 8.04
gretl_gretl-1.8.6-1_i386.deb
用 gdebi 安裝此 deb 檔 (應該顯示, 相依性已滿足), 然後下指令執行 gretl
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: liblapack.so.3: cannot open shared object file: No such file or directory
用管理權限, 在 /usr/lib 下, 找到 liblapack.so, 複制成 liblapack.so.3 即可
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libblas.so.3: cannot open shared object file: No such file or directory
用管理權限, 在 /usr/lib 下, 找到 libblas.so, 複制成 libblas.so.3 即可
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libg2c.so.0: cannot open shared object file: No such file or directory
用 synaptic 安裝 libg2c-dev 套件即可
XXX@ubu804-desktop:~$ gretl
gretl window 終於出現了, 但是沒有選單, 一定是少了什麼
試安裝 libgtk2.0-dev (系統會自動安裝許多其它相關套件...), 之後仍然有相同的錯誤
再試移除原有的 gretl (1.8.0), 還是不行, 試了
sudo apt-get autoremove
之後, 有些必要的套不見了:
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory
XXX@ubu804-desktop:~$ sudo apt-get install libgmp3-dev
sudo apt-get install fftw3-dev
終於成功了
gretl 1.8.7 以後有問題的話, 試試
gretl_gretl-1.8.6-1_i386.deb
用 gdebi 安裝此 deb 檔 (應該顯示, 相依性已滿足), 然後下指令執行 gretl
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: liblapack.so.3: cannot open shared object file: No such file or directory
用管理權限, 在 /usr/lib 下, 找到 liblapack.so, 複制成 liblapack.so.3 即可
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libblas.so.3: cannot open shared object file: No such file or directory
用管理權限, 在 /usr/lib 下, 找到 libblas.so, 複制成 libblas.so.3 即可
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libg2c.so.0: cannot open shared object file: No such file or directory
用 synaptic 安裝 libg2c-dev 套件即可
XXX@ubu804-desktop:~$ gretl
gretl window 終於出現了, 但是沒有選單, 一定是少了什麼
試安裝 libgtk2.0-dev (系統會自動安裝許多其它相關套件...), 之後仍然有相同的錯誤
再試移除原有的 gretl (1.8.0), 還是不行, 試了
sudo apt-get autoremove
之後, 有些必要的套不見了:
XXX@ubu804-desktop:~$ gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory
XXX@ubu804-desktop:~$ sudo apt-get install libgmp3-dev
sudo apt-get install fftw3-dev
終於成功了
gretl 1.8.7 以後有問題的話, 試試
sudo aptitude install liblapack-dev
2010年1月22日
Ubuntu 8,04 下的 GJR-garchm for gretl 1.8.4
gertl 估計結果
? ret = garchm(r, 1, 2, l1, 1, 0, 0, 0, 0.7, 1, 1, null, null)
================================================================
GJR-GARCH-in-Mean fucntion for gretl by Yi-Nung Yang
Chung Yuan Christian University, Taiwan
http://yaya.it.cycu.edu.tw/gretl
================================================================
The coefficient of GJR Term is gamma_i
Presample variance: backcast (parameter = 0.7)
Initial Values:
b1=-0.131806, omega=1.126780, alpha1=0.120000, alpha2=0.040000, gamma1=0.040000, beta1=0.600000,
------- mean eq & variance eq in this GARCH model --------
e= y -b1*X1
h = omega +alpha1*(e(-1))^2+alpha2*(e(-2))^2+gamma1*(e(-1))^2*(e(-1)<0)+beta1*h(-1)
================================================================
Using numerical derivatives
Tolerance = 1.81899e-012
Function evaluations: 166
Evaluations of gradient: 39
Model 8: 最大概似法 (ML), using observations 3-1361 (T = 1359)
ll = -0.5*(log(2*pi)+log(h) + (e^2)/h)
Standard errors based on Outer Products matrix
estimate std. error t-ratio p-value
--------------------------------------------------------
b1 -0.0670351 0.0246001 -2.725 0.0064 ***
omega 0.0101593 0.00146715 6.924 4.38e-012 ***
alpha1 -0.0870361 0.0151949 -5.728 1.02e-08 ***
alpha2 0.0597284 0.0162602 3.673 0.0002 ***
gamma1 0.146400 0.0172923 8.466 2.53e-017 ***
beta1 0.940360 0.00960635 97.89 0.0000 ***
Log-likelihood -1772.480 Akaike criterion 3556.959
Schwarz criterion 3588.246 Hannan-Quinn 3568.673
Replaced list ret
Evniews 估計結果
Dependent Variable: R
Method: ML - ARCH (Marquardt) - Normal distribution
Date: 01/22/10 Time: 01:34
Sample (adjusted): 1/06/2004 5/29/2009
Included observations: 1359 after adjustments
Estimation settings: tol= 0.00010, derivs=accurate numeric (linear)
Initial Values: C(1)=-0.13181, C(2)=1.19673, C(3)=0.13333, C(4)=0.04444,
C(5)=0.04444, C(6)=0.53333
Convergence achieved after 22 iterations
Presample variance: backcast (parameter = 0.7)
GARCH = C(2) + C(3)*RESID(-1)^2 + C(4)*RESID(-1)^2*(RESID(-1)<0) +
C(5)*RESID(-2)^2 + C(6)*GARCH(-1)
Coefficient Std. Error z-Statistic Prob.
R(-1) -0.068286 0.024528 -2.784002 0.0054
Variance Equation
C 0.010315 0.001488 6.934109 0.0000
RESID(-1)^2 -0.086935 0.015597 -5.573912 0.0000
RESID(-1)^2*(RESID(-1)<0) 0.146578 0.017262 8.491349 0.0000
RESID(-2)^2 0.059067 0.016569 3.564933 0.0004
GARCH(-1) 0.940811 0.009581 98.19407 0.0000
R-squared 0.013200 Mean dependent var -0.015854
Adjusted R-squared 0.009553 S.D. dependent var 1.330019
S.E. of regression 1.323651 Akaike info criterion 2.617407
Sum squared resid 2370.525 Schwarz criterion 2.640429
Log likelihood -1772.528 Hannan-Quinn criter. 2.626026
Durbin-Watson stat 2.145564
? ret = garchm(r, 1, 2, l1, 1, 0, 0, 0, 0.7, 1, 1, null, null)
================================================================
GJR-GARCH-in-Mean fucntion for gretl by Yi-Nung Yang
Chung Yuan Christian University, Taiwan
http://yaya.it.cycu.edu.tw/gretl
================================================================
The coefficient of GJR Term is gamma_i
Presample variance: backcast (parameter = 0.7)
Initial Values:
b1=-0.131806, omega=1.126780, alpha1=0.120000, alpha2=0.040000, gamma1=0.040000, beta1=0.600000,
------- mean eq & variance eq in this GARCH model --------
e= y -b1*X1
h = omega +alpha1*(e(-1))^2+alpha2*(e(-2))^2+gamma1*(e(-1))^2*(e(-1)<0)+beta1*h(-1)
================================================================
Using numerical derivatives
Tolerance = 1.81899e-012
Function evaluations: 166
Evaluations of gradient: 39
Model 8: 最大概似法 (ML), using observations 3-1361 (T = 1359)
ll = -0.5*(log(2*pi)+log(h) + (e^2)/h)
Standard errors based on Outer Products matrix
estimate std. error t-ratio p-value
--------------------------------------------------------
b1 -0.0670351 0.0246001 -2.725 0.0064 ***
omega 0.0101593 0.00146715 6.924 4.38e-012 ***
alpha1 -0.0870361 0.0151949 -5.728 1.02e-08 ***
alpha2 0.0597284 0.0162602 3.673 0.0002 ***
gamma1 0.146400 0.0172923 8.466 2.53e-017 ***
beta1 0.940360 0.00960635 97.89 0.0000 ***
Log-likelihood -1772.480 Akaike criterion 3556.959
Schwarz criterion 3588.246 Hannan-Quinn 3568.673
Replaced list ret
Evniews 估計結果
Dependent Variable: R
Method: ML - ARCH (Marquardt) - Normal distribution
Date: 01/22/10 Time: 01:34
Sample (adjusted): 1/06/2004 5/29/2009
Included observations: 1359 after adjustments
Estimation settings: tol= 0.00010, derivs=accurate numeric (linear)
Initial Values: C(1)=-0.13181, C(2)=1.19673, C(3)=0.13333, C(4)=0.04444,
C(5)=0.04444, C(6)=0.53333
Convergence achieved after 22 iterations
Presample variance: backcast (parameter = 0.7)
GARCH = C(2) + C(3)*RESID(-1)^2 + C(4)*RESID(-1)^2*(RESID(-1)<0) +
C(5)*RESID(-2)^2 + C(6)*GARCH(-1)
Coefficient Std. Error z-Statistic Prob.
R(-1) -0.068286 0.024528 -2.784002 0.0054
Variance Equation
C 0.010315 0.001488 6.934109 0.0000
RESID(-1)^2 -0.086935 0.015597 -5.573912 0.0000
RESID(-1)^2*(RESID(-1)<0) 0.146578 0.017262 8.491349 0.0000
RESID(-2)^2 0.059067 0.016569 3.564933 0.0004
GARCH(-1) 0.940811 0.009581 98.19407 0.0000
R-squared 0.013200 Mean dependent var -0.015854
Adjusted R-squared 0.009553 S.D. dependent var 1.330019
S.E. of regression 1.323651 Akaike info criterion 2.617407
Sum squared resid 2370.525 Schwarz criterion 2.640429
Log likelihood -1772.528 Hannan-Quinn criter. 2.626026
Durbin-Watson stat 2.145564
function list garchm (series depvar "Dep. var (應變數)", int GARCH[0:9:1] "GARCH p", int ARCH[1:9:1] "ARCH q", list indepvar[null] "Indpe var (自變數) list", int gjr_order[0:9:0] "GJR order (階次)", int option[0:3:0] "GRACH-in-Mean (選項 0:none; 1:stdev; 2:h; 3:lnh)", int LB_Q[0:200:0] "Ljung-Box Q (殘差 Q 檢定階次)", int LB_Q2[0:200:0] "Ljung-Box Q2 (殘差 Q2 檢定階次)", scalar backcast[0:1:0.7] "backcasting (參數)", bool ShowInit[0] "Show Init. (顯示起始值)?", bool save_resid[0] "Save standardized residual and h (儲存殘差和 h)?", string res_name[null] "User-defined residual (自訂殘差名稱)", string ht_name[null] "User-defined h (自訂 h 名稱)") #================================================================ # GJR-GARCH-in-Mean fucntion for gretl by Yi-Nung Yang # Chung Yuan Christian University, Taiwan # http://yaya.it.cycu.edu.tw/gretl #================================================================ set echo off set messages off # -------- variance equation ----------- # series h = omega + alpha*(e(-1))^2 + beta*h(-1) if ARCH=0 funcerr "ARCH q 必須大於 0" else string v_eq = "h = omega " string arch_param = "omega " loop j=1..ARCH --quiet sprintf arch_term "+alpha%d*(e(-%d))^2",j,j sprintf v_param "alpha%d ",j scalar @v_param = 0.04 string v_eq = v_eq ~ arch_term string arch_param = arch_param ~ v_param endloop if gjr_order>0 loop j=1..gjr_order --quiet sprintf arch_term "+gamma%d*(e(-%d))^2*(e(-%d)<0)",j,j,j sprintf v_param "gamma%d ",j scalar @v_param = 0.05 string v_eq = v_eq ~ arch_term string arch_param = arch_param ~ v_param endloop endif if GARCH>0 loop j=1..GARCH --quiet sprintf arch_term "+beta%d*h(-%d)",j,j sprintf v_param "beta%d ",j scalar @v_param = 0.04 string v_eq = v_eq ~ arch_term string arch_param = arch_param ~ v_param endloop endif endif # printf "%s\n", v_eq # printf "%s\n", arch_param tL2 = indepvar tL3 = indepvar || const genr is_const = (tL2 = tL3) if is_const = 1 tL2 -= const endif i=1 loop foreach j tL2 --quiet string temp="x" sprintf temp "X%d",i #producing tmp%d independent variables genr @temp = tL2.$j i=i+1 endloop scalar n_x = i-1 scalar j=1 # define ----------> mean eq. if is_const = 1 string m_eq = "e = y - b0 " string tParam = "b0 " else string m_eq = "e= y " string tParam = " " endif if n_x >=1 loop j=1..n_x --quiet sprintf tx "-b%d*X%d", j,j sprintf tparameter "b%d ", j scalar @tparameter = 0.0001 string m_eq = m_eq ~ tx string tParam = tParam ~ tparameter endloop endif if option>0 if option=1 string m_eq = m_eq ~ "-theta*h^0.5" string tPremium="SQRT(h)" endif if option=2 string m_eq = m_eq ~ "-theta*h" string tPremium="h" endif if option=3 string m_eq = m_eq ~ "-theta*log(h)" string tPremium="ln(h)" endif if option>3 funcerr "The GARCH-in-mean options are 1, 2, 3." endif string tParam = "theta " ~ tParam else string tPremium="None" endif # printf "%s\n", m_eq #scalar backcast=0.7 series y=depvar scalar mu = -0.037 scalar alpha1 = 0.15 - 0.03*(ARCH>1) scalar beta1 = 0.6 - 0.12*(GARCH>1) scalar gamma1=0.05 - 0.01*(ARCH>1) #### scalar theta =0.01879 scalar b0=-0.00377 scalar b1=0.5 scalar b2=0.4 #scalar omega = 1.149 #scalar omega =var(y)*(1-alpha1-beta1) scalar omega =var(y)*backcast*0.91 printf "\n\n\n\n" printf "================================================================\n" printf " GJR-GARCH-in-Mean fucntion for gretl by Yi-Nung Yang\n" printf " Chung Yuan Christian University, Taiwan\n" printf " http://yaya.it.cycu.edu.tw/gretl\n" printf "================================================================\n" if gjr_order>0 printf "The coefficient of GJR Term is gamma_i\n" endif if option>0 printf "GARCH in mean Term is %s\n",tPremium printf "The coefficient of GARCH in mean Term is theta\n" printf "----------------------------------------------------------------\n" endif printf "Presample variance: backcast (parameter = %.1f)\n",backcast # obtaining intiatial values from OLS and printing intial values # -----------ols ty const # -----------printf "islist()=%d, nelem()=%d ===>\n",islist(indepvar) ,nelem(indepvar) if nelem(indepvar) > 0 ols y indepvar --quiet # to keep the sample in use genr dum_original = $sample /* garch GARCH ARCH ; y indepvar if option=1 series tInMean=$h^0.5 elif option=2 series tInMean=$h elif option=3 series tInMean=log($h) endif */ # ----- obtaining initial value for theta (nelem>0) if option > 0 #garch GARCH ARCH ; y indepvar ols y indepvar --quiet if option=1 series tInMean=($uhat^2)^0.5 elif option=2 series tInMean=($uhat^2) elif option=3 series tInMean=log(($uhat^2)) endif ols y indepvar --quiet #series tInMean=($uhat^2)^0.5 ols y indepvar tInMean --quiet #ols y tInMean --quiet scalar theta= $coeff(tInMean) endif if ShowInit = 1 ### --- printing intial values printf "Initial Values:\n" if option >0 printf "theta=%.6f, ",theta endif endif ols y indepvar --quiet if is_const = 1 scalar b0=$coeff(const) if ShowInit = 1 ### --- printing intial values printf "b0=%.6f, ",b0 endif matrix B=$coeff k=$ncoeff-1 loop j=1..k --quiet scalar b$j = B[j+1] if ShowInit = 1 ### --- printing intial values printf "b%d=%.6f, ",j,b$j endif endloop else matrix B=$coeff k=$ncoeff loop j=1..k --quiet scalar b$j = B[j] if ShowInit = 1 ### --- printing intial values printf "b%d=%.6f, ",j,b$j endif endloop endif else # ======================--------if nelem = 0 ols y const --quiet # to keep the sample in use genr dum_original = $sample # ----- obtaining initial value for theta (nelem=0) if option > 0 #garch GARCH ARCH ; y indepvar if option=1 series tInMean=($uhat^2)^0.5 elif option=2 series tInMean=($uhat^2) elif option=3 series tInMean=log(($uhat^2)) endif ols y tInMean --quiet scalar theta= $coeff(tInMean) endif if ShowInit = 1 ### --- printing intial values printf "Initial Values:\n" if option >0 printf "theta=%.6f, ",theta endif endif endif if ShowInit = 1 ### --- printing intial values printf "omega=%.6f, ",omega loop j=1..ARCH --quiet printf "alpha%d=%.6f, ",j, alpha$j endloop if gjr_order>0 loop j=1..gjr_order --quiet printf "gamma%d=%.6f, ",j, gamma$j endloop endif if GARCH>0 loop j=1..GARCH --quiet printf "beta%d=%.6f, ",j, beta$j endloop endif endif string tAllParams = tParam ~ " " ~ arch_param # --- delete ---> printf "%s\n", tParam printf "\n------- mean eq & variance eq in this GARCH model --------\n" printf " %s\n",m_eq printf " %s\n",v_eq printf "================================================================\n" scalar presample=0 ####y[1]/backcast #see Eviews 6 Users guide, p.320 for algorithm loop j=2..100 --quiet presample = presample + backcast^(j-2)*y[j]^2 endloop mle ll = -0.5*(log(2*pi)+log(h) + (e^2)/h) series h = backcast^($nobs)*var(y) + (1-backcast)*presample #####series h = backcast^($nobs)*var(y) + (1-backcast)*(y[2]^2+backcast*y[3]^2+backcast^2*y[4]^2+backcast^3*y[5]^2+backcast^4*y[6]^2+backcast^5*y[7]^2) #------------------------series e = y - theta*h^0.5 series @m_eq #------------------------series e= y - b0 -b1*X1-b2*X2 # ---> to be deleted -----> series h = omega + alpha*(e(-1))^2 + beta*h(-1) series @v_eq params @tAllParams end mle genr dum_in_mle = $sample ##### printf ">>>>>>>>>>>>>>>>>>sample size in MLE, nobs=%d, T=%d\n",$nobs, $T # 定義計算 estimated residuals 要取幾個落後期 scalar start = $nobs-$T+1 # --- to be deleted ---> printf "NOBS=%d T=%d\n",$nobs,$T # ---- generating standardized residual and ht # ---- diagnosis of standardized residuals /* if LB_Q>0 && LB_Q2>0 smpl full series h = backcast^($nobs)*var(y) + (1-backcast)*presample series e=0 if option>0 End=$T-1 loop for j=1..End smpl j j genr @m_eq smpl +1 +1 genr @v_eq endloop genr @m_eq smpl full else series @m_eq series @v_eq endif series stz_u=e/h^0.5 series stz_u2 = stz_u^2 corrgm stz_u LB_Q --quiet corrgm stz_u2 LB_Q2 --quiet endif */ # ---- generating standardized residual (=e/h^0.5) and ht (=h) series h = backcast^($nobs)*var(y) + (1-backcast)*presample #series e=0 if option>0 End=$T-1 loop for j=start..End --quiet smpl j j genr @m_eq smpl +1 +1 genr @v_eq endloop genr @m_eq # 回復為原來的樣本 smpl dum_original --dummy --replace else series @m_eq series @v_eq endif if isstring(res_name) =0 sprintf res_name "stz_u" # default name for e(t) endif if isstring(ht_name) =0 sprintf ht_name "h" # default name for h(t) endif # 回復為原來的樣本 smpl dum_original --dummy --replace series @res_name =e/h^0.5 series @ht_name=h if LB_Q >0 corrgm @res_name LB_Q --quiet endif if LB_Q2>0 series stz_u2=@res_name^2 corrgm stz_u2 LB_Q2 --quiet endif if save_resid=1 list retlist= @res_name @ht_name return retlist else list retlist = const return retlist endif end function
2010年1月13日
自行打包 deb for gretl 1.8.6 in ubuntu 8.04
上一則 PO 已成功 compile gretl-1.8.6, 我在想, 可以打包成 deb, 以便安裝在其它的 (ubuntu 8.04) 電腦嗎, google 之後, 發現有人討論, see 討論來源:
如果只是單純的從原始碼經過編譯之後,自己做成deb檔案自己用,應該不用這麼複雜的去宣告有的沒有的。
通常原始碼都有 autogen.sh 或者 configure 檔案可以執行設定系統資訊。執行之後如果有缺乏的套件,會顯示出來告訴你需要安裝。
只要沒有錯誤,就可以執行編譯了
編譯之前,請先安裝checkinstall這個套件
sudo apt-get install checkinstall
make clean # 預防萬一,先清除暫存檔案
make # 開始編譯
經過漫長的編譯過程,編譯完成之後,請執行
sudo checkinstall
會問你一些小問題,不知道就按enter過去就好。
這個程式會模擬安裝你所編譯好的軟體,並且將編譯好的檔案做成deb檔案。是個很方便很好用的軟體。
試試看吧!
通常原始碼都有 autogen.sh 或者 configure 檔案可以執行設定系統資訊。執行之後如果有缺乏的套件,會顯示出來告訴你需要安裝。
只要沒有錯誤,就可以執行編譯了
編譯之前,請先安裝checkinstall這個套件
sudo apt-get install checkinstall
make clean # 預防萬一,先清除暫存檔案
make # 開始編譯
經過漫長的編譯過程,編譯完成之後,請執行
sudo checkinstall
會問你一些小問題,不知道就按enter過去就好。
這個程式會模擬安裝你所編譯好的軟體,並且將編譯好的檔案做成deb檔案。是個很方便很好用的軟體。
試試看吧!
最後顯示訊息:
**********************************************************************
Done. The new package has been installed and saved to
/home/yinung/gretl-1.8.6/gretl_1.8.6-1_i386.deb
You can remove it from your system anytime using:
dpkg -r gretl
**********************************************************************
Done. The new package has been installed and saved to
/home/yinung/gretl-1.8.6/gretl_1.8.6-1_i386.deb
You can remove it from your system anytime using:
dpkg -r gretl
**********************************************************************
待在其它電腦安裝看看囉!
/usr/local/bin$ cd ~
$ /usr/local/bin/gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libgretl-1.0.so.0: cannot open shared object file: No such file or directory
還是沒成功
在 /usr/local/lib 下, 找到
libgretl-1.0.so.0 和其它 3 個以 libgretl* 開始的檔案 (2個是 link 檔)
都複製到
/usr/lib
應該就 OK了
/usr/local/bin$ cd ~
$ /usr/local/bin/gretl
/usr/local/bin/gretl_x11: error while loading shared libraries: libgretl-1.0.so.0: cannot open shared object file: No such file or directory
還是沒成功
在 /usr/local/lib 下, 找到
libgretl-1.0.so.0 和其它 3 個以 libgretl* 開始的檔案 (2個是 link 檔)
都複製到
/usr/lib
應該就 OK了
2009年11月22日
在 ubuntu 8.04 下, 安裝 gretl 1.8.5
(假設己在 ubuntu 8.04 下, 裝好 alien 和 gdebi)
至 http://gretl.sourceforge.net/ 下載 gretl-1.8.5-1gtk2.i586.rpm
用 sudo alien -k gretl-1.8.5-1gtk2.i586.rpm 將 rpm 轉成 debian 格式
在 icon 上 (在由 alien 產生的gretl_1.8.5-1gtk2_i386.deb 檔) 點兩下, 會自動用 gdebi 開啟, 不過最後是失敗的, 訊息:
(正在讀取資料庫 ... 系統目前總共安裝有 144309 個檔案和目錄。)
正預備替換 gretl 1.8.0-1 (使用 gretl_1.8.5-1gtk2_i386.deb) ...
正在解壓縮替換的套件檔 gretl ...
dpkg:處理 gretl_1.8.5-1gtk2_i386.deb (--install)時出錯:
正試圖覆蓋“/usr/lib/libgretl-1.0.la”,它屬於套件 libgretl1
dpkg-deb: 子程序 paste 被信號(中斷的 pipe)終止了
在處理時有錯誤發生:
gretl_1.8.5-1gtk2_i386.deb
試了很多種方法, 問題應該是 gtk 版本太低所致, 後來先裝 OOO 3.1 (看能否幫我解決我不太懂的 dependence 的問題), 後來果然成功了! 可以 run gretl 1.8.6, 方法
1. 在 Ubuntu 安裝 OpenOffice.org 3.0
#ubuntu 8.04
deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu hardy main
deb-src http://ppa.launchpad.net/openoffice-pkgs/ubuntu hardy main
接著匯入 GPG Key:
$ gpg --keyserver keyserver.ubuntu.com --recv-key 60D11217247D1CFF
$ gpg --export --armor 60D11217247D1CFF > ooo.gpg
$ sudo apt-key add ooo.gpg
OK
最後進行套件更新:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
至 http://gretl.sourceforge.net/ 下載 gretl-1.8.5-1gtk2.i586.rpm
用 sudo alien -k gretl-1.8.5-1gtk2.i586.rpm 將 rpm 轉成 debian 格式
在 icon 上 (在由 alien 產生的gretl_1.8.5-1gtk2_i386.deb 檔) 點兩下, 會自動用 gdebi 開啟, 不過最後是失敗的, 訊息:
(正在讀取資料庫 ... 系統目前總共安裝有 144309 個檔案和目錄。)
正預備替換 gretl 1.8.0-1 (使用 gretl_1.8.5-1gtk2_i386.deb) ...
正在解壓縮替換的套件檔 gretl ...
dpkg:處理 gretl_1.8.5-1gtk2_i386.deb (--install)時出錯:
正試圖覆蓋“/usr/lib/libgretl-1.0.la”,它屬於套件 libgretl1
dpkg-deb: 子程序 paste 被信號(中斷的 pipe)終止了
在處理時有錯誤發生:
gretl_1.8.5-1gtk2_i386.deb
試了很多種方法, 問題應該是 gtk 版本太低所致, 後來先裝 OOO 3.1 (看能否幫我解決我不太懂的 dependence 的問題), 後來果然成功了! 可以 run gretl 1.8.6, 方法
1. 在 Ubuntu 安裝 OpenOffice.org 3.0
#ubuntu 8.04
deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu hardy main
deb-src http://ppa.launchpad.net/openoffice-pkgs/ubuntu hardy main
接著匯入 GPG Key:
$ gpg --keyserver keyserver.ubuntu.com --recv-key 60D11217247D1CFF
$ gpg --export --armor 60D11217247D1CFF > ooo.gpg
$ sudo apt-key add ooo.gpg
OK
最後進行套件更新:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
訂閱:
文章 (Atom)