You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+2-2
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ For a pull request to be accepted, you must meet the below requirements. This gr
35
35
Linting
36
36
~~~~~~~
37
37
38
-
Due to the way we have the CI builds set up, the linter won't do anything unless the environmental variable $LINT is set to a truthy value.
38
+
Due to the way we have the CI builds set up, the linter will not do anything unless the environmental variable $LINT is set to a truthy value.
39
39
40
40
- On MacOS/Linux
41
41
@@ -46,7 +46,7 @@ Due to the way we have the CI builds set up, the linter won't do anything unless
46
46
How to Submit a Pull Request
47
47
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
48
49
-
So you want to submit a patch to `statsmodels` but aren't too familiar with github? Here are the steps you need to take.
49
+
So you want to submit a patch to `statsmodels` but are not too familiar with github? Here are the steps you need to take.
50
50
51
51
1. `Fork <https://help.github.com/articles/fork-a-repo>`_ the `statsmodels repository <https://github.com/statsmodels/statsmodels>`_ on Github.
52
52
2. `Create a new feature branch <https://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging>`_. Each branch must be self-contained, with a single new feature or bugfix.
Copy file name to clipboardExpand all lines: docs/source/contrasts.rst
+3-3
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Patsy: Contrast Coding Systems for categorical variables
7
7
8
8
A categorical variable of K categories, or levels, usually enters a regression as a sequence of K-1 dummy variables. This amounts to a linear hypothesis on the level means. That is, each test statistic for these variables amounts to testing whether the mean for that level is statistically significantly different from the mean of the base category. This dummy coding is called Treatment coding in R parlance, and we will follow this convention. There are, however, different coding methods that amount to different sets of linear hypotheses.
9
9
10
-
In fact, the dummy coding is not technically a contrast coding. This is because the dummy variables add to one and are not functionally independent of the model's intercept. On the other hand, a set of *contrasts* for a categorical variable with `k` levels is a set of `k-1` functionally independent linear combinations of the factor level means that are also independent of the sum of the dummy variables. The dummy coding isn't wrong *per se*. It captures all of the coefficients, but it complicates matters when the model assumes independence of the coefficients such as in ANOVA. Linear regression models do not assume independence of the coefficients and thus dummy coding is often the only coding that is taught in this context.
10
+
In fact, the dummy coding is not technically a contrast coding. This is because the dummy variables add to one and are not functionally independent of the model's intercept. On the other hand, a set of *contrasts* for a categorical variable with `k` levels is a set of `k-1` functionally independent linear combinations of the factor level means that are also independent of the sum of the dummy variables. The dummy coding is not wrong *per se*. It captures all of the coefficients, but it complicates matters when the model assumes independence of the coefficients such as in ANOVA. Linear regression models do not assume independence of the coefficients and thus dummy coding is often the only coding that is taught in this context.
11
11
12
12
To have a look at the contrast matrices in Patsy, we will use data from UCLA ATS. First let's load the data.
13
13
@@ -72,7 +72,7 @@ Here we used `reference=0`, which implies that the first level, Hispanic, is the
72
72
73
73
contrast.matrix[hsb2.race-1, :][:20]
74
74
75
-
This is a bit of a trick, as the `race` category conveniently maps to zero-based indices. If it does not, this conversion happens under the hood, so this won't work in general but nonetheless is a useful exercise to fix ideas. The below illustrates the output using the three contrasts above
75
+
This is a bit of a trick, as the `race` category conveniently maps to zero-based indices. If it does not, this conversion happens under the hood, so this will not work in general but nonetheless is a useful exercise to fix ideas. The below illustrates the output using the three contrasts above
76
76
77
77
.. ipython:: python
78
78
@@ -113,7 +113,7 @@ Sum coding compares the mean of the dependent variable for a given level to the
113
113
res = mod.fit()
114
114
print(res.summary())
115
115
116
-
This correspons to a parameterization that forces all the coefficients to sum to zero. Notice that the intercept here is the grand mean where the grand mean is the mean of means of the dependent variable by each level.
116
+
This corresponds to a parameterization that forces all the coefficients to sum to zero. Notice that the intercept here is the grand mean where the grand mean is the mean of means of the dependent variable by each level.
0 commit comments