Eviews作图操作.docx

上传人:b****5 文档编号:6896605 上传时间:2023-01-12 格式:DOCX 页数:29 大小:240.55KB
下载 相关 举报
Eviews作图操作.docx_第1页
第1页 / 共29页
Eviews作图操作.docx_第2页
第2页 / 共29页
Eviews作图操作.docx_第3页
第3页 / 共29页
Eviews作图操作.docx_第4页
第4页 / 共29页
Eviews作图操作.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

Eviews作图操作.docx

《Eviews作图操作.docx》由会员分享,可在线阅读,更多相关《Eviews作图操作.docx(29页珍藏版)》请在冰豆网上搜索。

Eviews作图操作.docx

Eviews作图操作

Eviews7中的图形操作

Wfcreatewfopenwfselectwfstatswfsave

一、图形的分类

1.线条图,如errbar、hile、line、spike

2.填充图,如area、bar、pie

图,如xy、xyline、xypair、scat

4.统计图,如boxplot、cdfplot、hist、distplotkernel、qqplot

5.其他对象的特有图形,如方程对象的置信椭圆cellipse

图形能方便地实现数据和计量分析结果的可视化。

图形对象包含对象的图形视图和图形对象。

可以把图象视图定格成图形对象再进行修改。

二、创建图形对象

图形可以用graph命令创建,也可以从其他对象的图形视图定格而来。

@

如graphgdp(或graphgfgdp,默认为线条图)

用freeze命令把其他对象的图形视图定格成图形对象。

如freeze(gf)

merge命令是合并已有的图形对象

freeze(g1)

showg1

graphm1

showg2

graphgfgg

showg3

多个子图,用align命令设置排列方式,例如

'

Graph(m)log(gdp)log(m1)rs

(2,,1)

三、定制图形

图形对象可以通过程序修改的部分有:

线型(pattern)和填充,图例(legend)和图框(frame),坐标轴,还可以在图形对象上增加文本、线和阴影等。

1.图框使用options命令,例如

graphrs

Copygf1gf2

indent(缩进)

Copygf1gf3

–inbox(去掉边框)

Copygf1gf4

size(8,3)(修改为8,3虚拟英寸)

Graphgf1gf2gf3gf4

–display

(2,1,1)

Deletegf

2.坐标轴

有些图形命令,如line,对多个序列作图时,有如下坐标轴选项:

a:

自动选择坐标轴,横轴在底部,纵轴在左边。

d:

双坐标轴,第一个序列对应左边的坐标轴,其他序列对应右边的坐标轴,第一个序列的图形与其他序列不相交。

$

x:

同d,但允许相交。

n:

将序列标准化。

例如

graphrspr

copygf1gf2

(left)log(采用对数坐标)

copygf1gf3

(2)axis(right)(将价格水平的坐标放到右边)

copygf3gf4

overlap(允许相交)

graphgf1gf2gf3gf4

}

(2,2,2)

deletegf

showgfas

命令scale有invert和range等选项,设置反向坐标轴和坐标轴的标注范围。

Graphlog(gdp)

Copygf1gf2

invert

Copygf1gf3

linearzero

Copygf1gf4

range(4,8)

Graphgf1gf2gf3gf4

–display

(2,1,1)

Deletegf

Showgfa1

坐标的外观,时间标度等也可以进行设置。

例如

Graphlog(rs)

Copygf1gf2

mirrorzeroline(增加零线,左右同时给出刻度)

Copygf1gf3

interval(year,10)(横轴刻度是10年)

Copygf1gf4

–labelgridticksin(去掉标度,增加网格线,刻度在里面)

Graphgf1gf2gf3gf4

–display

(2,1,1)

Deletegf

Showgfag

wfopenhs

#

smpl1988@last

graphhs

showgf1

format(yyyy)interval(year,1)

-display

copygf1gf2

showgf2

format(yyyy)interval(year,1)-span

graphgf1gf2

(2,1,1)

showgf

3.颜色和线型

:

wfopendemo

smpl1990@last

graphgdpm1

copygf1gf2

showgf2

(2)lcolor(orange)lwidth

(2)

copygf1gf3

showgf3

(1)lpat(dash1)symbol(star)

copygf3gf4

showgf4

-color

Graphgf1gf2gf3gf4

(2,1,1)

Deletegf

Smpl@all

Showgf1c

4.填充和纹线

matrix(2,3)mm

"

1,5,3,4,6,2

showmm

freeze(gf1)

showgf1

Copygf1gf2

–color

showgf2

-color

copygf1gf3

(1)gray(5)hatch(7)

·

(2)gray

(1)hatch(3)

(3)gray(3)hatch(4)

copygf3gf4

showgf4

-color

graphgf1gf2gf3gf4

(2,2,2)

showgff

5.标注

>

可以用addtext命令在图形中添加文字,用draw命令突出某些内容。

例如graphrs

showrs

closers

showgf1

copygf1gf2

(t)"shorttreminterestrate"

(l)"percent"

showgf2

(shade,bottom,rgb(235,200,180))8085

(dashline,left,color(red))8

graphgf1gf2

(2,1,1)

-display

showgfat

6.图例

可以控制图例的位置、文本和外观。

graphlog(gdp)log(m1)prrs

showgf1

(3)PriceLevel

copygf1gf2

-inboxposition,columns

(1)

/

(4)

graphgf1gf2

(2,2,2)

showgfag

font(20)设置字体

–display不要图例

四、图形模板

通过模板,可以复制图形类型、线型和填充的设置、坐标轴的标度方式、图例的各种属性和图框的各种设定等。

graphlog(gdp)log(m1)

showgf0

?

(1)lwidth(4)

(2)symbol

(1)

(shade,bottom)8085

graph(o=gf0)pr*10rs

showgf1

graph(t=gf0)pr*10rs

showgf2

还可以在图形创建后再应用模板,例如

$

Graphpr*10rs

(o)gf0

Graphpr*10rs

(t)gf0

五、打印和导出

保存成图形文件。

Save命令支持三种常用的矢量图形文件,分别是wmf文件、emf文件、eps文件。

例如

(t=wmf,u=in,w=4,-c)mygf

命令名:

freeze\graph\save\merge\align\template\options\name\addtext\legend\draw\scale\setelem

直方图

hist

关键字hist为命令distplot的分析设定(analyticalspec)。

hist有自己的选项。

标度类型:

scale={dens,freq,relfreg},分别表示密度直方图、频数直方图(默认)和频率直方图。

柱宽:

binw={eviews,sigma,iqr,silverman,freefman}.

锚点:

anchor=num

分界点:

rightclosed

图例文字:

leg={def,n,s,det},默认给出最少信息,其他三个选项对应的图例文字信息分别为无文本、短文本和详细信息。

折现直方图:

distplotfreqpoly

边线直方图:

distplotedgefreqpoly

移位直方图:

distplotash

wfopendemo

@

freeze(gf01)freqpoly

showgf01

Freeze(gf02)edgefreqpoly(fill)

showgf02

freeze(gf03)histash

showgf03

freeze(gf04)hist(binw=silverman,anchor=ash

showgf04

<

增加正态分布曲线:

选中要画图的序列,打开,点view/gragh在specific里选中distribution,右边的distribution框选择histogram。

点击右边的option,在弹出来的框里点add,弹出的add框里选TheoreticalDensity。

点击ok再点击ok。

最后点击ok。

经验分布函数图

Eviews5cdfplot

Eviews7distplotcdf

Distplotcdf命令,默认绘制累积分布函数函数(选项c),还支持生存函数(选项s)和分位数函数(选项q)。

例如

cdf

(说明:

showsthecumulativedistributionplotforlnwage,alongwiththedefault95%confidenceintervals.)

cdf(noci)则是不显示95%的置信区间

survivor(noci)

groupgro1weightheight

logsurvivor(ci=,leg=det)

(说明displaysthelog-survivorplotsforWEIGHTandHEIGHTalongwith90%confidenceintervals,andadetailedlegend.Theplotswillbedisplayedinindividualgraphframes.)

(s)quantile

(说明showsthequantileplotsforWEIGHTandHEIGHTinthesamegraphframe.)

QQ图

比较两个分布的工具。

如果分布相同,QQ图应该是一条直线。

理论QQ图(正态分布n,均匀分布u,指数分布e,Logistic分布l,第一类极值分布x),经验QQ图(s=name).

serieswage=exp(lnwage)

groupwwagelog(wage)

freeze(gfw)(n)

showgfw

(2,1,1)

wfopendemo

rndseed(type=mt)12357

groupdist@rnorm@rchisq(5)

freeze(gf)(s=dist)

showgf

(2,1,1)

直接比较PDF.如何绘制序列和某种分布的PDF

Dokernel(@obsrange,b=3,o=mrs)

seriesx

seriesrsk

groupgxrsk

mtos(mrs,g)

genry=@dchisq(x,5)

chi-squre(5)

interestrate

graphxyrsk

showgfd

"

-inboxposition,columns

(1)

盒图

wfopengarch

groupgraaar3

freeze(gfb)

showgfb

产生盒图的命令中,boxplot是群对象命令,进行多个序列的盒图比较。

而boxplotby是序列对象的命令,绘制单个序列内不同分组的盒图。

修改盒图元素的命令为setbpelem.例如

Copygfbgfn

ci(notch)

将盒图中间的阴影部分改为凹槽。

*

Syntax语法

boxplot(options)o1[o2o3...]

(options)[categorical_spec(arg)]

whereo1,o2,...,areseriesorgroupobjects.Youmayspecifygeneraloptionsaftertheboxplotkeyword.

Theoptionalcategorical_specallowsyoutospecifyacategoricalgraph(see"CategoricalSpec").

Options

q=arg

Setthequantilemethod,whereargcanbe:

"r"-Rankit-Cleveland,"o"-Ordinary,"v"-vanderWaerden,"b"-Blom,"t"-Tukey,"g"-Gumbel.

rotate

Rotatethegraphsotheobservationaxisisontheleft.

|

Multipleseriesoptions(categoricalgraphsettingswilloverridetheseoptions)

m

Plotboxplotsinmultiplegraphs.

Paneloptions

Thefollowingoptionapplieswhengraphingpanelstructureddata:

panel=arg(defaulttakenfromglobalsettings)

Paneldatadisplay:

"stack"(stackthecross-sections),"individual"or"i"(separategraphforeachcross-section),"combine"or"c"(computecross-sectiongraphsinasingleframe).

(Note:

moregeneralversionsofthesepanelgraphsmaybeconstructedascategoricalgraphs.)

Examples

Basicexamples

.

displaysboxplotsfortheseriesWAGE.

groupg1wagesexrace

displaysboxplotsforWAGES,SEXandRACEinasinglegraphframe.

(m,rotate)

placestherotatedboxplotsforeachseriesinaseparateframe.

Panelexamples

(panel=individual)

displaysboxplotsforeachcross-sectioninaseparateframe,while,

(panel=stack)

displaysasingleboxplotcomputedfromthestackedpaneldata.

}

(panel=combined,rotate)

showsrotatedboxplotscomputedforeachperiod(acrosscross-sections)inasingleframe.

Categoricalspecexamples

across(firm,dispname)

displaysacategoricalboxplotgraphofSER1usingdistinctvaluesofFIRMtodefinethecategories,anddisplayingtheresultinggraphsinmultipleframeswithcommonscaling.EachframeislabeledusingtheFIRMdisplayname.

across(firm,dispname,iscale)

constructsthesamegraphwithindividualscaling.

within(firm,label=value)

constructsaboxplotforeachvalueofFIRManddisplaystheresultsinasingleframe.TheindividualboxplotsarelabeledusingthevalueofFIRMassociatedwiththecategory.

across(firm)within(income,bintype=quant,bincount=4)

constructsacategoricalboxplotwithFIRMdefiningtheacrossdimension,andINCOMEdefiningthewithindimension.BoxplotsforeachINCOMEquartileofagivenfirmwillbecontainedinasingleframe,withdifferentfirmsdisplayedindifferentframes.

within(sex)within(union)

createsanboxplotforwithincategoriesbasedonbothSEXandUNION.Sincewehavenotspecifiedbehaviorfortheimplicit@SERIESinGRP1,eachseriesinthegroupwillbedisplayedinaseparateframe,withindividualscaling.

element_list

Theelement_listmaycontainoneormoreofthefollowing:

median,med/-median,-med

[Show/Donotshow]themedians.

mean/-mean

[Show/Donotshow]themeans.

whiskers,w/-whiskers,-w

[Show/Donotshow]thewhiskers(linesfromtheboxtothestaples).

staples,s/-staples,-s

[Show/Donotshow]thestaples(linesdrawnatthelastdatapointwithintheinnerfences).

near/-near

[Show/Donotshow]thenearoutliers(valuesbetweentheinnerandouterfences).

far/-far

[Show/Donotshow]thefaroutliers(valuesbeyondtheouterfences).

width(arg)(default="fixed")

Setthewidthsettingsfortheboxplots,whereargisoneof:

"fixed"(uniformwidth),"n"(proportionaltosamplesize),"rootn"(proportionaltothesquarerootofsamplesize).

 

Setthedisplaymethodfortheconfidenceintervals,whereargisoneof:

"none"(donotdisplay),"shade"(shadedintervals),"notch"(notchedintervals).

Examples

.

-farwidth(n)ci(notch)

hidesthefaroutliers,setstheboxwidthsproportionaltothenumberofobservations,andenablesnotchingoftheconfidenceintervals.

distplot

Displayadistributiongraph.

Syntax

distplot(options)o1[o2o3...]

(options)analytical_spec(arg)[categorical_spec(arg)]

whereo1,o2,...,areseriesorgroupobjects.

Whenusedasacommand,distplotonlyallowsyoutodisplaythedefaulthistogramview.

Whenusedasanobjectview,youmustspecifythetypeofdistributiongraphyouwishtocreateintheanalytical_spec.Youmayselectfrom:

histogram,histogrampolygon,histogramedgepolygon,averageshiftedhistogram,kerneldensity,theoreticaldistribution,empiricalCDF,empiricalsurvivor,empiricallogsurvivor,orempiricalquantile(see"AnalyticalSpec").

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1