# [Stata] Kruskal-Wallis tests calculation

#### momo

##### New Member
Hi,

Please, how to calculate Kruskal-Wallis tests for the four groups of companies (only domestically orientated companies, exporters, ‘direct investors’ and mixed strategy user) and to know are significantly different?

Kruskal-Wallis tests for the log values of the variables:
age, number of employees, productivity and intangible fixed assets

Remark: the observations included off-course in one stata file, so should I make a distinguish between the groups by a dummy for example

what is the commands, and what does mean in exact the outcome variable shown in stata window

is it for example to do new variable with four values 1,2,3 and 4 represents four types of companies and use it ad outcome and other variables shown above used as a defining groups variables.

Last edited:

#### CB

##### Super Moderator
Hi Momo, given that your question seems to apply to Stata in specific I have added the software package into your thread title, as you can see. Usual practice is to put the software type in brackets at the beginning of thread titles in this sub-forum.

#### terzi

##### TS Contributor
Hi,

what is the commands, and what does mean in exact the outcome variable shown in stata window

is it for example to do new variable with four values 1,2,3 and 4 represents four types of companies and use it ad outcome and other variables shown above used as a defining groups variables.

Kruskal Wallis only compares one outcome at at a time. Therefore, the outcome variable will be your response, which you are trying to compare. If you want to compare age, number of employees and that other stuff, you will require two or three separate kruskal Wallis test.

By the way, the new variable with four values 1,2,3 and 4 that represents four types of companies would be the grouping variable.

Oh, and the command use is kwallis, but it would be easy for you to use the menus: Statistics>Nonparametric Analyses>Test of Hypothesis>Kruskal Wallis

#### momo

##### New Member
Thank you Terzi
Actually, under Statistics>Nonparametric Analyses, there are nothing relating the KW test. But it actually exist under summaries, tables & tests>nonparametric tests of hypothesis>Kruskal wallis rank test, where I am using stata 8 edition.

So I think its the same but the results that I got it as follows for the four ranks of companies.

for example
the first type of companies with on variable, the domestic firms with age

chi-squared = 1404.069 with 1787 d.f.
probability = 1.0000

chi-squared with ties = 1912.042 with 1787 d.f.
probability = 0.0199

so what is this mean.

where the previuos studies show results as I need for example:
..............employee.............age
..................cof. .................cof.

Domestic −2.368 (0.032) −0.284 (0.130)

and so on