简体   繁体   English

MATLAB:如何绘制Probit函数?

[英]MATLAB: How can I plot the Probit function?

I wrote the following code to plot the Logit function where beta = 1. 我编写了以下代码来绘制其中beta = 1的Logit函数。

beta = 1
e(:,1) = 0:0.01:1;
e(:,2) = log(e(:,1)./(1-e(:,1)))+beta;
plot(e(:,2),e(:,1))

As far as I can tell that looks fine, but I don't know how to add the Probit function. 据我所知,这看起来不错,但是我不知道如何添加Probit函数。 I understand how to put to plots in one figure, but I don't understand how to generate data from this distribution. 我了解如何在一个图中放置图,但不了解如何从该分布生成数据。 Is there some convenient way to do this in MATLAB? 在MATLAB中有一些便捷的方法吗?

Ultimately I'm looking to create something like the following, in which it can be seen that the Probit and Logit are very similar. 最终,我希望创建类似于以下内容的东西,可以看出Probit和Logit非常相似。

概率论与Logit

beta = 1
e(:,1) = 0:0.01:1;
e(:,2) = log(e(:,1)./(1-e(:,1)))+beta; % logit fn + beta
e(:,3) = sqrt(2) * erfinv(2*e(:,1) - 1) ; % probit fn
plot(e(:,1),e(:,2:3))

As suggested by @patrick if you have the "Machine learning and statistic toolbox" it would be cleaner to use the norminv function, that is replace the 4th line by: 如@patrick所建议,如果您拥有“机器学习和统计工具箱”,则使用norminv函数会更干净,即用以下内容代替第四行:

e(:,3) = norminv(e(:,1)) ; % probit fn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM