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

📄 twoway_function.hlp

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

{title:Title}

{p2colset 5 34 36 2}{...}
{p2col :{hi:[G] graph twoway function} {hline 2}}Twoway line plot of function{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 35 2}
{cmdab:tw:oway}
{cmd:function}
[[{it:y}]=]
{it:f}({it:x})
{ifin}
[{cmd:,}
{it:options}]

{p2colset 9 30 32 2}{...}
	{it:options}{col 30}description
	{hline 68}
	{cmdab:ra:nge:(}{it:#} {it:#}{cmd:)}{...}
{col 30}plot over {it:x} = {it:#} to {it:#}
	{opth ra:nge(varname)}{...}
{col 30}plot over {it:x} = min to max of {it:varname}
	{cmd:n(}{it:#}{cmd:)}{...}
{col 30}evaluate at {it:#} points; default is 300

	{cmdab:dropl:ines:(}{it:{help numlist}}{cmd:)}{...}
{col 30}draw lines to axis at specified {it:x} values
	{cmd:base(}{it:#}{cmd:)}{...}
{col 30}base value for {cmd:dropline()}; default is 0

	{cmdab:hor:izontal}{...}
{col 30}draw plot horizontally

	{cmdab:yvarf:ormat:(}{help format:{bf:%}{it:fmt}}{cmd:)}{...}
{col 30}display format for {it:y}
	{cmdab:xvarf:ormat:(}{help format:{bf:%}{it:fmt}}{cmd:)}{...}
{col 30}display format for {it:x}

	{it:{help cline_options}}{...}
{col 30}change look of plotted line

INCLUDE help gr_axlnk

INCLUDE help gr_twopt
	{hline 68}
{pin}
All explicit options are {it:rightmost}, except {cmd:horizontal}, which is
{it:unique}; see {help repeated options}.

{phang}
Note that
{cmd:if} {it:exp} and {cmd:in} {it:range} play no role unless option
{cmd:range(}{it:varname}{cmd:)} is specified.

{phang}
In the above syntax diagram,
{it:f}({it:x}) stands for an {it:exp}ression in terms of {cmd:x}.


{title:Description}

{pstd}
{cmd:twoway function} plots {it:y} = {it:f}({it:x}), where {it:f}({it:x})
is some function of {cmd:x}.
That is, you literally type

	{cmd:. twoway function y=sqrt(x)}

{pstd}
It makes no difference whether {cmd:y} and {cmd:x} are variables in your data.


{title:Options}

{phang}
{cmd:range(}{it:#} {it:#}{cmd:)}
and
{opth range(varname)}
    specify the range of values for {it:x}.  In the first syntax,
    {cmd:range()} is a pair of numbers identifying the minimum and maximum.
    In the second syntax, {it:range()} is a variable name, and the range used
    will be obtained from the minimum and maximum values of the variable.
    If {cmd:range()} is not specified, {cmd:range(0 1)} is assumed.

{phang}
{cmd:n(}{it:#}{cmd:)}
    specifies the number of points at which {it:f}({it:x}) is to be
    evaluated.  The default is {cmd:n(300)}.

{phang}
{cmd:droplines(}{it:numlist}{cmd:)}
    adds dropped lines from the function down to, or up to, the axis (or
    {it:y}={cmd:base()} if {cmd:base()} is specified) at each {it:x} value
    specified in {it:numlist}.

{phang}
{cmd:base(}{it:#}{cmd:)}
    specifies the base for the {cmd:droplines()}.  The default is
    {cmd:base(0)}.  This option does not affect the range of the axes, so you
    may also want to specify the {it:twoway_option}
    {cmd:yscale(range(}{it:#}{cmd:))} as well; see 
    {it:{help axis_scale_options}}.

{phang}
{cmd:horizontal}
    specifies that the roles of {it:y} and {it:x} be interchanged and that the
    graph be plotted horizontally rather than vertically (that the plotted
    function be reflected along the identity line).

{phang}
{cmd:yvarformat(%}{it:fmt}{cmd:)} and
{cmd:xvarformat(%}{it:fmt}{cmd:)}
    specify the display format to be used for {it:y} and {it:x}.  These
    formats are used when labeling the axes; see 
    {it:{help axis_label_options}}.

{phang}
{it:cline_options}
     specify how the function line is rendered;
     see {it:{help cline_options}}.

INCLUDE help gr_axlnkf

INCLUDE help gr_twoptf


{title:Remarks}

{pstd}
Remarks are presented under the headings

	{help twoway function##remarks1:Typical use}
	{help twoway function##remarks3:Advanced use 1}
	{help twoway function##remarks2:Advanced use 2}


{marker remarks1}{...}
{title:Typical use}

{* index functions, graphing}{...}
{pstd}
You wish to plot the function {it:y}=exp(-{it:x}/6)sin({it:x}) over the
range 0 to 4pi:

	{cmd:. twoway function y=exp(-x/6)*sin(x), range(0 12.57)}
	  {it:({stata "twoway function y=exp(-x/6)*sin(x), range(0 12.57)":click to run})}
{* graph gtfunc1}{...}

{pstd}
A better rendition of the graph above is

	{cmd}. twoway function y=exp(-x/6)*sin(x), range(0 12.57)
		yline(0, lstyle(foreground))
		xlabel(0 3.14 "pi" 6.28 "2 pi" 9.42 "3 pi" 12.57 "4 pi")
		plotregion(style(none))
		xsca(noline){txt}
	  {it:({stata "gr_example2 twofunc":click to run})}
{* graph twofunc}{...}

{pstd}
{cmd:yline(0, lstyle(foreground))}
added a line at {it:y}=0; {cmd:lstyle(foreground)} gave the line the same style
as used for the axes.  See {it:{help added_line_options}}.

{pstd}
{cmd:xlabel(0 3.14 "pi" 6.28 "2 pi" 9.42 "3 pi" 12.57 "4 pi")}
labeled the {it:x} axis with the numeric values given and substituted text
for the numeric values; see 
{it:{help axis_label_options}}.

{pstd}
{cmd:plotregion(style(none))}
suppressed the border around the plot region; see {it:{help region_options}}.

{pstd}
{cmd:xsca(noline)}
suppressed the drawing of the {it:x}-axis line;
see {it:{help axis_scale_options}}.


{marker remarks2}{...}
{title:Advanced use 1}

{pstd}
The following graph appears in many introductory textbooks:

	{cmd}. twoway
	      function y=normden(x), range(-4 -1.96) color(gs12) recast(area)
	  ||  function y=normden(x), range(1.96 4)   color(gs12) recast(area)
	  ||  function y=normden(x), range(-4 4) lstyle(foreground)
	  ||,
	      plotregion(style(none))
	      ysca(off) xsca(noline)
	      legend(off)
	      xlabel(-4 "-4 sd" -3 "-3 sd" -2 "-2 sd" -1 "-1 sd" 0 "mean"
		      1  "1 sd"  2  "2 sd"  3  "3 sd"  4  "4 sd"
		      , grid gmin gmax)
	      xtitle(""){txt}
	  {it:({stata "gr_example2 twofunc2":click to run})}
{* graph twofunc2}{...}

{pstd}
We drew the graph in three parts:  the shaded area on the left, the
shaded area on the right, and then the overall function.  To obtain
the
shaded areas, we used the {it:advanced_option} {cmd:recast(area)} so that,
rather than the function being plotted by {cmd:graph} {cmd:twoway} {cmd:line},
it was plotted by {cmd:graph} {cmd:twoway} {cmd:rarea}; see 
{it:{help advanced_options}} and {helpb twoway rarea}.
Concerning the overall function, we drew it last so that its darker
foreground-colored line would not get covered up by the shaded areas.


{marker remarks3}{...}
{title:Advanced use 2}

{* index added lines, y=x}{...}
{pstd}
{cmd:function} plots may be overlaid with other {cmd:twoway} plots.
For instance, {cmd:function} is one way to add {it:y}={it:x} lines to a plot:

	{cmd:. sysuse sp500, clear}

	{cmd:. scatter open close, msize(*.25) mcolor(*.6) ||}
	{cmd:  function y=x, range(close) yvarlab("y=x") clwidth(*1.5)}
	  {it:({stata `"gr_example sp500: scatter open close, msize(*.25) mcolor(*.6) || function y=x, range(close) yvarlab("y=x")"':click to run})}
{* graph gtfunc2}{...}

{pstd}
In the above, we specified the {it:advanced_option} {cmd:yvarlab("y=x")}
so that the variable label of {it:y} would be treated as "y=x" in the
construction of the legend; see {it:{help advanced_options}}.
We specified {cmd:msize(*.25)} to make the marker symbols smaller, and
we specified {cmd:mcolor(*.6)} to make them dimmer; see 
{it:{help relativesize}}
and 
{it:{help colorstyle}}.


{title:Also see}

{psee}
Manual:  {bf:[G] graph twoway function}

{psee}
Online:  {helpb line}
{p_end}

⌨️ 快捷键说明

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