fitnlm and dummy variables
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all, Fitnlm allows automatic creation of dummy variables, if one input the categorical predictor as a nominal or ordinal array. It worked fine for me with fitlm. But I do not understand how I know how many input arguments I get after using the automatic creation of dummy variables. As I need to specify my beta0 I need to know how many input arguments I have. Thank you!
0 Commenti
Risposta accettata
the cyclist
il 18 Giu 2014
Modificato: the cyclist
il 18 Giu 2014
I haven't used the automatic creation of dummy variables, so I don't know the answer to your question. However, the dummyvar() function might also be helpful for you, so I thought I'd mention it.
3 Commenti
the cyclist
il 23 Giu 2014
Suppose you have the following grouping variable (where "1", "2", etc represent the groups):
group = [1;1;1;2;2;3;3;3;3;4]
Then
dv = dummyvar(group)
gives
dv =
1 0 0 0
1 0 0 0
1 0 0 0
0 1 0 0
0 1 0 0
0 0 1 0
0 0 1 0
0 0 1 0
0 0 1 0
0 0 0 1
Each column of dv is a variable in your regression. The first column is the binary variable "is_member_of_group?", where 1=yes and 0=no. Likewise for other columns.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!