10ª e 11ª aulas práticas de FMIE Lab. Inf. 0.19– EEG |
***ANTES DE RESPONDER A QUALQUER QUESTÃO***
1º Guardar o ficheiro de dados em c:\
2º Abrir o STATA
3º DO-file editor
4º log using c:\*.log
5º use c:\AmostraQP1.dta (ficheiro de dados resultante do trabalho das aulas anteriores).
TAREFAS:
8ª Questão: Vai proceder a um teste de associação entre as variáveis categoria de dimensão das empresas e sector de actividade económica. Todavia, antes de o proceder responda à seguinte questão: - Que resultados espera encontrar desta associação? |
Questão: Apresente o teste do qui-quadrado para verificar a independência (ou não) entre
as duas variáveis mencionadas:
H0 : Não existe associação entre as variáveis H1 : Existe associação entre as variáveis |
*teste qui-quadrado: teste à associação entre 2 variáveis
tab cae catnl (Stata Help: veja a opção chi2 do comando tabulate)
Questão: - Acha pertinente a questão subjacente à realização do teste de associação efectuado?
- Se sim, justifique a razão. Se não, considerando as variáveis do ficheiro proceda a uma questão que leve à realização de um novo teste (ou testes) de associação entre as variáveis. |
**PODE CONSULTAR O SEU FICHEIRO DE RESULTADOS (FICHEIRO *.LOG) EM QUALQUER EDITOR DE TEXTO**
O QUE DEVERIA SABER:
- o que é uma variável: categórica (nominal, ordinal), numérica (contínua, discreta);
- distinguir estatística descritiva e estatística indutiva;
- distinguir entre frequências relativas, absolutas e acumuladas;
- medidas de localização: média, moda e mediana;
- medidas de dispersão: variância e desvio padrão;
- medidas de assimetria e curtose;
- calcular o coeficiente de correlação;
- características de uma distribuição normal;
- o que é um intervalo de confiança
- testes de hipóteses: passos
(teste t à média de duas variáveis;)
- Tipos e características de amostras aleatórias: simples, estratificadas, cluster
- teste de hipóteses de associação pelo qui-quadrado de Pearson
Exemplos de testes qui-quadrado em stata:
Chi-square test
A chi-square test is used when you want to see if there is a relationship between
two categorical variables. In Stata, the chi2 option is used with the tabulate
command to obtain the test statistic and its associated p-value.
Using the hsb2 data file, let's see if there is a relationship between the type of school
attended (schtyp) and students' gender (female). Remember that the chi-square test assumes
the expected value of each cell is five or higher. This assumption is easily met in the
examples below. However, if this assumption is not met in your data, please see the section on
Fisher's exact test below. . tabulate schtyp female, chi2 type of | female school | male female | Total -----------+----------------------+---------- public | 77 91 | 168 private | 14 18 | 32 -----------+----------------------+---------- Total | 91 109 | 200 Pearson chi2(1) = 0.0470 Pr = 0.828
These results indicate that there is no statistically significant relationship between the type
of school attended and gender (chi-square with one degree of freedom = 0.0470, p = 0.828).
Let's look at another example, this time looking at the relationship between gender (female)
and socio-economic status (ses). The point of this example is that one (or both) variables
may have more than two levels, and that the variables do not have to have the same number of
levels. In this example, female has two levels (male and female) and ses has three levels
(low, medium and high). . tabulate female ses, chi2 | ses female | low middle high | Total -----------+---------------------------------+---------- male | 15 47 29 | 91 female | 32 48 29 | 109 -----------+---------------------------------+---------- Total | 47 95 58 | 200 Pearson chi2(2) = 4.5765 Pr = 0.101 Again we find that there is no statistically significant
relationship between the variables (chi-square with two degrees of
freedom = 4.5765, p = 0.101).
See also * Stata Learning Module: A Statistical Sampler in Stata * Stata Teaching Tools: Probability Tables * Stata Teaching Tools: Chi-squared distribution
Informação retirada de: http://www.ats.ucla.edu/stat/stata/whatstat/whatstat.htm