This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Load the "Matching" library. | |
> install.packages("Matching") | |
> library(Matching) | |
# 2. Load the lalonde data set into working memory. | |
> data(lalonde) | |
# 3. What are the dimensions of the data set? | |
> str(lalonde) | |
## 445 observations of 12 variables (445x12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Question 1 (using "dim") | |
# What are the dimensions of the data set (how many rows and columns)? | |
dim(GerberGreenImai) | |
## [1] 10829 26 | |
# Question 2 (using "names") | |
# What are the variable names? | |
names(GerberGreenImai) | |
## [1] "PERSONS" "WARD" "QUESTION" "MAILGRP" "PHONEGRP" "PERSNGRP" | |
## [7] "APPEAL" "CONTACT" "MAILINGS" "AGE" "MAJORPTY" "VOTE96.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First we import the base automaton | |
from automata.base.automaton import Automaton #Begin by importing the following | |
from automata.tm.ntm import NTM | |
ntm = NTM( | |
states={'q1', 'q2', 'q3', 'q4','q5','q6','q7','q8','qA'}, | |
input_symbols={'0', '1', '#'}, | |
tape_symbols={'0', '1', '#','x','.'}, | |
transitions={ | |
'q1': { |