⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsline.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 08apr2005}{...}
{cmd:help tsline} {right:dialogs:  {bf:{dialog tsline}{space 9}}}
{right:{dialog twoway_overlay:overlaid twoway}{space 0}}
{hline}

{title:Title}

{p2colset 5 32 34 2}{...}
{p2col 5 20 26 2:{hi:[TS] tsline} {hline 2}}Plotting time-series data{p_end}
{p2col :{hi:[G] graph twoway tsline} {hline 2}}Plotting time-series data{p_end}
{p2colreset}{...}


{title:Syntax}

{pstd}
Time-series line plot:

{p 8 24 2}
[{cmdab:tw:oway}]
{cmd:tsline}
	{it:varlist}
	{ifin}
	[{cmd:,}
	{it:tsline_options}
	{it:{help twoway_options}}]

{pstd}
Time-series range plot with lines:

{p 8 25 2}
[{cmdab:tw:oway}]
{cmd:tsrline}
	{it:y_1} {it:y_2}
	{ifin}
	[{cmd:,}
	{it:tsrline_options}
	{it:{help twoway_options}}]

{phang}
where the time variable is assumed set by {helpb tsset}, {it:varlist} has the
interpretation

		{it:y_1} [{it:y_2} ... {it:y_k}]


	{it:tsline_options}{col 35}description
	{hline 60}
	{it:{help scatter:scatter_options}}{...}
{col 35}any of the options allowed by
{col 35}{cmd:graph} {cmd:twoway} {cmd:scatter} with the
{col 35}exception of
{col 35}     {it:marker_options}
{col 35}     {it:marker_placement_options}
{col 35}     {it:marker_label_options}
{col 35}which will be ignored if specified
	{hline 60}

	{it:tsrline_options}{col 35}description
	{hline 60}
	{help twoway_rline:rline_options}{...}
{col 35}any of the options allowed by
{col 35}{cmd:graph} {cmd:twoway} {cmd:rline}
	{hline 60}
{pin}
See {helpb twoway rline} and {helpb scatter}.


{title:Description}

{pstd}
{cmd:tsline} draws line plots for time-series data.
{cmd:tsrline} draws a range plot with lines for time-series data.

{pstd}
{cmd:tsline} and {cmd:tsrline} are both commands and {it:plottype}s as defined
in {helpb twoway}.  Thus, the syntax for {cmd:tsline} is

	{cmd:. graph twoway tsline} ...

	{cmd:. twoway tsline} ...

	{cmd:. tsline} ...

{pstd}
and similarly for {cmd:tsrline}.
Being plottypes, these commands may be combined with other plottypes in the
{cmd:twoway} family, as in,

{phang2}
	{cmd:. twoway (tsrline} ...{cmd:) (tsline} ...{cmd:) (lfit} ...{cmd:)} ...

{pstd}
which can equivalently be written

{phang2}
	{cmd:. tsrline} ... {cmd:|| tsline} ... {cmd:|| lfit} ... {cmd:||} ...


{title:Options}

{phang}
{it:line_options}
    are any of the options allowed by the {cmd:graph} {cmd:twoway}
    {cmd:scatter} command except that {it:marker_options},
    {it:marker_placement_options}, and {it:marker_label_options} will be
    ignored if specified; see {helpb scatter}.

{phang}
{it:rline_options}
    are any of the options allowed by the {cmd:graph} {cmd:twoway}
    {cmd:rline} command; see {helpb twoway rline}.

{phang}
{it:twoway_options} are any of the options documented in 
{it:{help twoway_options}}.  These include options for titling the graph (see
{it:{help title_options}}), options for saving the graph to disk (see
{it:{help saving_option}}), and the {cmd:by()} option, which will allow
you to simultaneously plot different subsets of the data (see 
{it:{help by_option}}).

{pmore}
Also see the {cmd:recast()} option discussed in 
{it:{help advanced_options}} for information on how to plot spikes, bars,
etc., instead of lines.


{title:Remarks}

{pstd}
We simulated two separate time series (each of 200 observations) and placed
them in a Stata dataset (e.g. {cmd:tsline1.dta}).  The first series simulates
an AR(2) process with {it:phi}_1=0.8 and {it:phi}_2=0.2; the second series
simulates an MA(2) process with {it:theta}_1=0.8 and {it:theta}_2=0.2.  In the
following we use {cmd:tsline} to graph these two series.

	{cmd:. sysuse tsline1, clear}
	{cmd:. tsset lags}
	{cmd:. tsline ar ma}
	  {it:({stata "tsline_ex arma":click to run})}

{pstd}
Suppose we kept a calorie log for an entire calendar year.  At the end of the
year, we would have a dataset (e.g. {cmd:tsline2.dta}) that contains the
amount of calories consumed for 365 days.  We could then use {cmd:tsset} to
identify the date variable and use {cmd:tsline} to plot calories versus time.
Knowing that we tend to eat a little more food on Thanksgiving and Christmas
day, we use the {cmd:ttick()} and {cmd:ttext()} options to point these days
out on the time axis.

	{cmd:. sysuse tsline2, clear}
	{cmd:. tsset day}
	{cmd:. tsline calories, ttick(28nov2002 25dec2002 , tpos(in))}
	{cmd:      ttext(3470 28nov2002 "thanks"}
	{cmd:            3470 25dec2002 "x-mas""}
	{cmd:            , orient(vert))}
	  {it:({stata "tsline_ex calories":click to run})}

{pstd}
We were uncertain of the exact values we logged, so we also gave a range for
each day.  Here is a plot of the summer months.

	{cmd:. sysuse tsrline2, clear}
	{cmd:. tsset day}
	{cmd:. tsrline lcal ucal if tin(1may2002,31aug2002)}
	{cmd:      || tsline cal}
	{cmd:      || if tin(1may2002,31aug2002), ytitle(Calories)}
	  {it:({stata "tsline_ex rcalories":click to run})}

{pstd}
Options associated with the time axis allow dates to be specified in place of
elapsed time values.  For instance, we used

{pmore}
{cmd:ttick(28nov2002 25dec2002 , tpos(in))}

{pstd}
to place tick marks at the specified dates.  This works similarly for
{cmd:tlabel}, {cmd:tmlabel}, and {cmd:tmtick}.

{pstd}
Suppose we wanted to place vertical lines for the previously mentioned
holidays.  We could specify the dates in the {cmd:tline()} option as follows:

	{cmd:. sysuse tsline2, clear}
	{cmd:. tsset day}
	{cmd:. tsline calories, tline(28nov2002 25dec2002)}
	  {it:({stata "tsline_ex calories2":click to run})}

{pstd}
We could also modify the format of the time axis so that only the day in the
year is displayed in the labeled ticks:

	{cmd:. sysuse tsline2, clear}
	{cmd:. tsset day}
	{cmd:. tsline calories, tlabel(, format(%tdmd)) ttitle("Date (2002)")}
	  {it:({stata "tsline_ex calories3":click to run})}


{title:Also see}

{psee}
Manual:  {bf:[TS] tsline}{break}
         {bf:[G] graph twoway tsline}

{psee}
Online:  {helpb tsset}; {helpb scatter}, {helpb xtline};
{it:{help twoway_options}},
{it:{help advanced_options}}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -