goglhosting.blogg.se

Stata crosstab
Stata crosstab




stata crosstab

I compare this data to some data from the (made up for this example) Portland Pet People Project which says that 65% of Portlanders own a dog or a cat, 15% own what I classified as a small creature, 19% own fish or no pet, and 1% own something more exotic. In the end, I have three hundred tallymarks divided into three categories: big mammals (dogs, cats): 106, small creatures (birds, rabbits, rats, etc):55, fish/none:137, exotics (difficult sealife, snakes, etc.): 2. Then, because I don't want sample bias, I spend another day outside of the Library and a third outside the Sports Center.

stata crosstab

I spent a complete day in Commons stopping people as they leave, making sure they're not prospies, staff or faculty, and asking what kind of pet they have.

stata crosstab

In either case, if no expected values are specified Stata assumes you expect an equal distribution.įor example, perhaps I have hypothesized that Reed students make different pet choices than do Portlanders. Alternatively, you can use chitest which will just pull the observed and expected data from columns rather than user input. The syntax for the command is as follows chitesti #observed1 #oberved2 #observedN \ #expected1 #expected2 #expectedN where N implies the command can go on as long as it needs to. Instead, you simply tell STATA both the observed and the expected frequencies and let it take care of the math. This package does not require that you use a dataset. To run a chi-square for goodness of fit, you are going to need the package described above. Which one you use depends on what type of chi-square you want to perform (single variable versus multiple variables). In addition to the built-in function encompassed by tabulate there is a fairly nice user-created package ( findit tab chi cox and select the first package found - this package is used with the command chitesti). There are various ways to run chi-square analyses in Stata. Missing values: Some relevant documentationĭata Management FAQ: Replacing missing values (stata.The chi-square analysis is a useful and relatively flexible tool for determining if categorical variables are related. You may also wish to recode or replace missing values see below for more details on those operations. Examples:ĭrop cases missing string data (for variable "important_string_variable")ĭrop cases missing numeric data (for variable "important_numeric_variable")ĭrop cases missing data (string or numeric, for variable "important_either_kind_of_variable")ĭrop if missing(important_either_kind_of_variable) Use Stata's drop command, combined with a logical / conditional statement, to drop missing values. ( More on findit and installing packages) These packages do not come with Stata, but can be downloaded by typing findit mdesc at the Stata command line. Additional resources you can use to investigate missing values are the packages mdesc, mvpatters, and misschk. The command summarize will list how many missing values you have. When you load data into Stata, you will likely look at descriptive statistics or some other data summary. Regression - if an observation is missing data for a variable in the regression model, that observation is excluded from the regression (listwise deletion of missing data).Correlations - calculated on pairs with non-missing data by default (pairwise deletion of missing data) use pwcorr for listwise deletion of missing data.Tabulate - missing values excluded by default use missing option within tab to include missing values.Summarize - uses only non-missing values.Some common procedures are below for others, check the Stata documentation. Missing data values will affect how Stata handles your data. If you are working with string variables, the data will appear as. In Stata, if your variable is numeric and you are missing data, you will see.

#STATA CROSSTAB SOFTWARE#

MPG = 0 is very different from MPG = "I'm not sure."ĭifferent statistical software code missing data differently. (This may seem obvious, but I have had many students nonchalantly say "oh, so we can just replace those with zeros." Nope.) Consider this in the context of gas mileage. Check your metadata/codebook to make sure you know what you are working with!) For numeric data, keep in mind that missing data are not the same as a value of zero. (Some datasets have these three cases coded differently others lump them together. In survey data, missing values may mean that the surveyor did not ask the question, that the respondent did not answer the question, or that the data are truly missing. Note: When working with missing data, you need to consider why that data is missing.






Stata crosstab