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

📄 drawnorm.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 25feb2005}{...}
{cmd:help drawnorm}{right:dialog:  {bf:{dialog drawnorm}}}
{hline}

{title:Title}

{p2colset 5 21 24 2}{...}
{p2col :{hi:[D] drawnorm} {hline 2}}Draw sample from multivariate normal distribution{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 17 2}{cmd:drawnorm} {it:{help newvarlist}}
[{cmd:,} {it:options}]

{synoptset 22 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{synopt :{opt clear}}replace the current dataset{p_end}
{synopt :{opt d:ouble}}generate variable type as {opt double}; default is {opt float}{p_end}
{synopt :{opt n(#)}}{it:#} of observations to be generated; default is current number{p_end}
{synopt :{opt sd:s(vector)}}standard deviations of generated variables{p_end}
{synopt :{opt corr(matrix|vector)}}correlation matrix{p_end}
{synopt :{opt cov(matrix|vector)}}covariance matrix{p_end}
{synopt :{cmdab:cs:torage:(}{cmdab:f:ull)}}correlation/covariance structure is stored as a symmetric k*k matrix{p_end}
{synopt :{cmdab:cs:torage:(}{cmdab:l:ower)}}correlation/covariance structure is stored as lower triangular matrix{p_end}
{synopt :{cmdab:cs:torage:(}{cmdab:u:pper}{cmd:)}}correlation/covariance structure is stored as an upper triangular maxtrix{p_end}
{synopt :{opt m:eans(vector)}}means of generated variables; default is {cmd:means(0)}{p_end}

{syntab :Options}
{synopt :{opt seed(#)}}seed for random-number generator{p_end}
{synoptline}
{p2colreset}{...}


{title:Description}

{pstd}
{cmd:drawnorm} draws a sample from a multivariate normal distribution with
desired means and covariance matrix.  The default is orthogonal data, mean
0, variance 1.  The values generated are a function of the current
random-number seed or the number specified with {cmd:set seed()} option; see
{helpb generate}.


{title:Options}

{dlgtab:Main}

{phang}
{opt clear} specifies the dataset in memory be replaced, even though the
current dataset has not been saved on disk.

{phang}
{opt double} specifies that the new variables be stored as Stata
{opt double}s, meaning 8-byte reals. If {opt double} is not specified,
variables are stored as {opt float}s, meaning 4-byte reals. See 
{help data types}.

{phang}
{opt n(#)} specifies the number of observations to be
generated.  The default is the current number of observations.  If {opt n(#)}
is not specified or is the same as the current number of observations,
{opt drawnorm} adds the new variables to the existing dataset; otherwise,
{opt drawnorm} replaces the data in memory.

{phang}
{opt sds(vector)} specifies
the standard deviations of the generated variables.  {opt sds()} may not be
specified with {opt cov()}.

{phang}
{opt corr(matrix|vector)} specifies the correlation matrix.
If neither {opt corr()} nor {opt cov()} is
specified, the default is orthogonal data.

{phang}
{opt cov(matrix|vector)} specifies the covariance matrix.
If neither {opt corr()} nor {opt cov()} is
specified, the default is orthogonal data.

{phang}
{cmd:cstorage(full}|{cmd:lower}|{cmd:upper)}
specifies the storage mode for the correlation or covariance structure in
{opt corr()} or {opt cov()}.  The following storage modes are supported:

{phang2}
{opt full} specifies that the correlation or covariance structure
is stored (recorded) as a symmetric k*k matrix.

{phang2}
{opt lower} specifies that the correlation or covariance structure is recorded
as a lower triangular matrix.  With k variables, the matrix
should have k(k+1)/2 elements in the following order:

{p 16 20 2}
C(11) C(21) C(22) C(31) C(32) C(33) ... C(k1) C(k2) ... C(kk)

{phang2}
{opt upper} specifies that the correlation or covariance structure is recorded
as an upper triangular matrix.  With k variables, the
matrix should have k(k+1)/2 elements in the following order:

{p 16 20 2}
C(11) C(12) C(13) ... C(1k) C(22) C(23) ... C(2k) ...
C(k-1k-1) C(k-1k) C(kk)

{pmore}
Specifying {cmd:cstorage(full)} is optional if matrix is square.
{cmd:cstorage(lower)} or {cmd:cstorage(upper)} is required for the vectorized
storage methods.   See {help storage modes} for examples.

{phang}
{opt means(vector)} specifies the means of the generated variables.  The
default is {cmd:means(0)}.

{dlgtab:Options}

{phang}
{opt seed(#)} specifies the initial value of the
random-number seed used by the {opt uniform()} function.  The default is the
current random-number seed.  Specifying {opt seed(#)} is the same
as typing {cmd:set seed} {it:#} before issuing the {cmd:drawnorm} command.
{p_end}


{title:Examples}

{pstd}
Generate 2000 independent observations ({cmd:x},{cmd:y});
{cmd:x} with mean 2 and standard deviation 5;
{cmd:y} with mean 3 and standard deviation 5,

{phang2}{cmd:. matrix m = (2,3)}{p_end}
{phang2}{cmd:. matrix sd = (.5,2)}{p_end}
{phang2}{cmd:. drawnorm x y, n(2000) means(m) sds(sd)}{p_end}
{phang2}{cmd:. summarize}

{pstd}
Draw a sample of 1000 observations from a bivariate standard normal
distribution, with correlation 0.5

{phang2}{cmd:. matrix C = (1, .5 \ .5, 1)}{p_end}
{phang2}{cmd:. drawnorm x y, n(1000) corr(C)}

{pstd}
Equivalently,

{phang2}{cmd:. matrix C = (1, .5, 1)}{p_end}
{phang2}{cmd:. drawnorm x y, n(1000) corr(C) cstorage(lower)}


{title:Also see}

{psee}
Manual:  {bf:[D] drawnorm}

{psee}
Online:  {helpb corr2data}, {helpb generate}
{p_end}

⌨️ 快捷键说明

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