Commit c198837e authored by Rubin, Paul's avatar Rubin, Paul

Corrected spelling errors.

parent b064860f
......@@ -13,7 +13,7 @@ The function "stepwise" defined below performs stepwise regression based on a "n
To keep it simple, I made no provision for forcing certain variables to be included in all models. The current version has the following properties.
* You can specificy a data frame, using the optional data argument (as with `lm`).
* You can specify a data frame, using the optional data argument (as with `lm`).
* The code does some consistency checks (such as whether your sample size exceeds the number of variables, and whether your alpha-to-enter is less than your alpha-to-leave, but not whether the initial model is a subset of the full model). If one of the checks fails, the function will nag you and return `NA`.
* A constant term is optional. Whether or not a constant term is included is controlled by its presence/absence in the initial model specified, regardless of whether the full model has one.
* Both the full and initial models can be specified as formulas or as character vectors (strings). In other words, `y ~ x` and `"y ~ x"` should work equally well.
......@@ -159,7 +159,7 @@ stepwise <-
The rest of the notebook demonstrates the function in operation.
The first tests of the function will be done using the `swiss` dataset (47 observations of 6 variables) from the `datasets` package. We will (arbitrarily) use alpha = 0.05 to add a variable and alpha = 0.10 to remove one.
The first tests of the function will be done using the `swiss` data set (47 observations of 6 variables) from the `datasets` package. We will (arbitrarily) use alpha = 0.05 to add a variable and alpha = 0.10 to remove one.
```{r}
data(swiss)
......@@ -200,7 +200,7 @@ stepwise(Fertility ~ Agriculture + Examination + Education + Catholic + Infant.M
Whether the final model contains a constant term or not depends on how the initial model is specified (with or without one), irrespective of whether the full model contains a constant term.
First, we include the constant in the full model but not in the intial model.
First, we include the constant in the full model but not in the initial model.
```{r}
stepwise(Fertility ~ 1 + Agriculture + Examination + Education + Catholic + Infant.Mortality, Fertility ~ 0 + Examination + Education, aToEnter, aToLeave)
......@@ -226,7 +226,7 @@ The result of this is a missing model.
result
```
We are done with the `swiss` dataset.
We are done with the `swiss` data set.
```{r}
detach(swiss)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -222,7 +222,7 @@ stepwise("Fertility ~ 1 + Agriculture + Examination + Education + Catholic + Inf
# Multicollinearity
Use a modified version of the dataset to verify that multicollinearity does not cause problems.
Use a modified version of the data set to verify that multicollinearity does not cause problems.
```{r}
swiss2 <- swiss
......@@ -243,7 +243,7 @@ rm(swiss, swiss2)
# Variable names used in the function scope
Create a small test dataframe.
Create a small test data frame.
```{r}
set.seed(456) # for reproducibility
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment