I have a data set that lists every country in Africa, what their main contribution is to their GNI (industry,agriculture, etc), their GNI, and whether or not they have access to the sea. I need to find the relation between having access to the sea and GNI, and then what kind of economy they have an GNI (separately). I beleive the simplest way to do this would be with linear regression, but I'm not sure how to transform the string variables into something I can actually use in the comparison. Any help on this would be appreciated

# Solved – Linear regression between nominal and ordinal variables?

categorical dataordinal-dataregression

## Best Answer

Easier than that, it's just a t-test. The outcome (GNI) is continuous unless you've grouped it into ranges. The predictor is binary, whether or not you're by the sea.

You only need to create an "indicator variable" for the two groups in question: whether or not you're beside the sea. Indicator variables take on a 1 when some condition is true and are 0 otherwise. Creating such a variable allows you to directly estimate the means between the two groups defined by 0/1 values. Most statistical software packaged will do this for you automatically once it recognizes you've included a string variable as a predictor.