logit_dgp.ox

来自「时间序列分析中著名的OxMetrics软件包」· OX 代码 · 共 18 行

OX
18
字号
// This returns data that follow a logit model with the
// supplied parameters. n is the number of observations.
// Note how the binary 0/1 variable is generated so that
// it really follows the logit model

logit_dgp(const n, const theta)
{
	decl k, x, y;
	
	k = sizer(theta); //sizer returns the number of rows of theta
	x = ones(n,1) ~ rann(n,k-1);

	y = (1 ./ (1 + exp(-x*theta)) .> ranu(n,1));
	
	return y ~ x;
	
}

⌨️ 快捷键说明

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