linear discriminant analysis: how to generate a simulation example with an outcome variable of 3 groups
2 次查看(过去 30 天)
显示 更早的评论
Dear Community, I've been trying to simulate data to use for a linear discriminant classification later. below, you find the code for simulated data with the dependent variable "G" that has 2 classes (0 and 1). The N observations are assigned to G using the Sigmoid function. Now, I would like to generate an example where the dependent variable "G" has 3 groups. Could anyone help me how to proceed? Can I do it with the Sigmoid function as well?
Many thanks!!
N=3000;
C=20;
x=randn(N,C);
beta=zeros(C,1);
param_true = [1 3 5 7 9];
beta(param_true)=[+10 -10 +5 -1 +1];
z=x*beta;
L=1./(1+exp(-z));
G=rand(N,1)<L;
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!