Connect to LAW in the Course Register.
 TO INEQUAL 3 SH 001 LEC MW 3-4:20PM TANE 145 LESNICK H MAX: 70 LAW -528 INTRO TO GENL BUS LAW 3 SH 301 LEC T 5:30-8:15PM GITT 213 MAX: 30 LAW -529 REGULATORY STATE 3 SH 301 LEC R 5:30-8:15PM SILV 280 FINKEL A MAX: 14 LAW -532 COMMON LAW CONTRACTS 2 SH 001 LEC M 8:30-10:20AM SILV 240B ROSENBERG MAX: 80 LAW -533 PRIVACY IN LAW 3 SH 401 LEC TR 3-4:20PM GITT 1 YOO C CROSS LISTED: COMM-533 SECTION MAX: 90 MAX W/CROSS LIST: 110 LAW -542 BUSINESS STRATEGY & CORP 3 SH 401 LEC T 4:30-6:30PM GITT 214 GOLKIN PERMISSION NEEDED FROM DEPARTMENT CROSS LISTED: LGST-785 MGMT-785 SECTION MAX: 24 MAX W/CROSS LIST: 48 LAW -543 WRITING FOR PRACTICE 3 SH 001 LEC TR 10:30-11:50AM TANE 253 SHORE D PERMISSION NEEDED FROM DEPARTMENT MAX: 12 LAW -547 BOK: LATIN AMERICA 1 SH 001 ALVIAR GARCIA H LEC MWF 1:30-2:50PM TANE 345 PERMISSION NEEDED FROM DEPARTMENT DATES: 04/06/15 - 04/24/15 BOK: EUROPEAN TAX 1 SH MAX: 20 002 LEC MWF 1:30-2:50PM TANE 253 SCHOEN W PERMISSION NEEDED FROM DEPARTMENT DATES: 03/16/15 - 04/03/15 MAX: 14 LAW -550 BUSINESS MANAGEMENT 3 SH 001 LEC TR 4:45-6:15PM TBA STAFF PERMISSION NEEDED FROM DEPARTMENT MAX: 75 LAW -553 LAW IN AMER LIFE 3 SH 001 LEC TR 3-4:20PM SILV 280 GORDON S MAX: 30 LAW -555 PROFESSIONAL RESPONSBLTY 2 SH 001 LEC M 4:30-6:20PM GITT 213 REICH A MAX: 75 002 LEC W 4:30-6:20PM SILV 240A SULLIVAN J MAX: 30 003 LEC R 4:30-6:20PM SILV 240A BROWNING S MAX: 80 004 LEC R 12:50-2:40PM TANE 345 VEASEY E MAX: 24 005 LEC M 4:30-6:20PM SILV 280 LANDAU B MAX: 40 LAW -582 ADV LEGAL RESEARCH 2 SH 001 LEC TR 10:30-11:50AM SILV 240A GEORGE P PERMISSION NEEDED FROM DEPARTMENT DATES: 01/12/15 - 02/27/15 MAX: 75 LAW -586 NONPROFIT ORGANIZATIONS 2 SH 001 LEC R 4:30-6:20PM TANE 345 BRADLEY J MAX: 20 LAW -595 PRETRIAL LITIGATION 2 SH 001 LEC W 4:30-6:20PM GK 70 NGUYEN H PERMISSION NEEDED FROM DEPARTMENT MAX: 12 LAW -601 ADMINISTRATIVE LAW 3 SH 001 LEC TR 3-4:20PM GITT 213 LEE S MAX: 110 LAW -604 SENTENCING 2 SH 001 LEC W 4:30-6:20PM TANE 122 KYRIAKAKIS A MAX: 12 LAW -607 ANTITRUST 3 SH 001 LEC TR 3-4:20PM SILV 240B LANGER H MAX: 70 LAW -611 LEGISLATION 3 SH 001 LEC TR 3-4:20PM SILV 240A GELBACH J MAX: 80 LAW -612 APPELLATE ADVOCACY 3 SH 001 LEC R 1-3PM GK 70 RIPPLE R MAX: 12 LAW -613 TECHNOLOGY AND POLICY 3 SH 401 LEC TR 1:30-2:50PM GITT 214 YOO C CROSS LISTED: COMM-613 SECTION MAX: 30 MAX W/CROSS LIST: 50 LAW -618 INTERNATIONAL BANKRUPTCY 2 SH 001 SEM T 6:40-8:30PM TANE 142 LAPOWSKY R DATES: 01/20/15 - 04/24/15 MAX: 20 LAW -620 INT'L BUSINESS TRANS. 3 SH 001 LEC TR 10:30-11:50AM SILV 280 MOONEY C MAX: 40 LAW -622 CORPORATIONS 3 SH 001 LEC MW 10:30-11:50AM SILV 240B PAREDES MAX: 80 LAW -629 ISLAMIC FINANCE 2 SH 001 LEC M 1-2:50PM TANE 112 MCMILLEN M MAX: 25 LAW -631 EVIDENCE 3 SH 001 FINKELSTEIN C LEC TR 10:30-11:50AM SILV 240B MAX: 80 002 LEC MW 3-4:20PM SILV 245A FERTEL J MAX: 70 LAW -633 CORPORATE TAXATION 2 SH 001 LEC R 4:30-6:20PM GITT 1 SEDLACK J MAX: 110 LAW -640 FEDERAL INCOME TAX 3 SH 001 LEC MW 3-4:20PM SILV 280 SANCHIRICO C MAX: 40 LAW -644 FIRST AMENDMENT 4 SH 001 LEC MTW 10:30-11:45AM TANE 145 WOLFF T MAX: 70 LAW -645 INSURANCE LAW & POLICY 3 SH 001 LEC MW 9-10:20AM TANE 345 BAKER T MAX: 25 LAW -646 BANKRUPTCY 3 SH 001 LEC TR 3-4:20PM GITT 214 MOONEY C MAX: 110 LAW -649 INTERDISC CHILD ADV CLIN 6 SH 001 CLN MW 1:30-2:50PM TANE 142 FINCK K AN ACADEMICALLY BASED COMMUNITY SERV COURSE PERMISSION NEEDED FROM DEPARTMENT MAX: 10 LAW -651 NEGOTIATION & DISP RES 3 SH 001 LEC R 7-10PM GITT 214 DIAMOND S PERMISSION NEEDED FROM DEPARTMENT MAX: 42 LAW -652 CIVIL PRACTICE CLINIC 7 SH 001 CLN TR 1:30-2:50PM TANE 142 RULLI L PERMISSION NEEDED FROM DEPARTMENT MAX: 12 LAW -655 TRANSNAT'L LEGAL CLINIC 7 SH 001 CLN MW 1:30-2:50PM TANE 320 PAOLETTI S PERMISSION NEEDED FROM DEPARTMENT MAX: 8 LAW -656 ADVANCED CLINIC 3 SH 001 CLN MW 1:30-2:50PM TANE 320 PAOLETTI S MAX: 30 002 CLN TBA ECKSTEIN S ADVANCED CLINIC 2 SH MAX: 2 003 CLN TBA RULLI L MAX: 30 LAW -659 EMPLOYMNT DISCRIMINATION 3 SH 001 LEC TR 1:30-2:50PM SILV 280 MAYERI S MAX: 40 LAW -660 INTERNATIONAL LAW 3 SH 001 LEC MW 3-4:20PM GITT 214 BURKE-WHITE W MAX: 110 LAW -662 SECURITIES REGULATION 4 SH 001 LEC MWR 10:30-12NOON GITT 1 FISCH J PERMISSION NEEDED FROM DEPARTMENT MAX: 110 LAW -669 DETKIN IP & TECH CLINIC 7 SH 001 CLN MW 1:30-2:50PM SILV M28 DAHL C PERMISSION NEEDED FROM DEPARTMENT MAX: 8 LAW -671 ADVANCED COPYRIGHT 3 SH 001 BALGANESH S LEC TR 10:30-11:50AM TANE 112 MAX: 24 LAW -672 REMEDIES 3 SH 001 LEC MW 9-10:20AM TANE 145 WAX A MAX: 70 LAW -676 ELECTION LAW 2 SH 001 LEC W 6:30-8:20PM TANE 320 GOLDFEDER J PERMISSION NEEDED FROM DEPARTMENT MAX: 26 LAW -677 PATENT LAW 4 SH 001 LEC TWR 3-4:15PM SILV 147 WAGNER R MAX: 24 LAW -680 ENTREPRENEURSHIP CLIN 7 SH 001 CLN TR 1:30-2:50PM TANE 320 KOSURI P PERMISSION NEEDED FROM DEPARTMENT MAX: 16 LAW -685 CRIMINAL DEFENSE CLINIC 4 SH 001 CLN WF 9-12NOON SILV 52 TEMPLE J PERMISSION NEEDED FROM DEPARTMENT MAX: 8 LAW -687 HEALTH LAW 3 SH 001 LEC TR 3-4:20PM GITT 2 RUGER T MAX: 110 LAW -694 TOPICS IN DEFAMATION 2 SH 001 LEC R 5-6:50PM GK 238 FRANCIS MAX: 14 LAW -695 LAND USE LAW 3 SH 001 LEC F 10:30-12:30PM GITT 214 PRITCHETT W MAX: 110 LAW -696 CON CRIMINAL PROCEDURE 3 SH 001 LEC TR 9-10:20AM GK 100 RUDOVSKY D MAX: 110 LAW -702 TRIAL ADVOCACY II 2 SH 001 LEC M 7-9PM TANE 145 PRATTER G MAX: 75 LAW -705 MENTAL HEALTH LAW 3 SH 001 LEC MW 10:30-11:50AM TANE 320 MORSE S MAX: 20 LAW -712 LAW & SOCIETY IN JAPAN 3 SH 001 LEC MW 3-4:20PM TANE 345 FELDMAN E MAX: 24 LAW -715 JURISP OF SPORT 3 SH 001 LEC MW 3-4:20PM SILV 240A BERMAN M MAX: 80 LAW -716 SUPREME COURT CLINIC 4 SH 001 LEC MTR 1:30-2:45PM GK 238 BIBAS S YEAR LONG COURSE MAX: 12 LAW -718 TRUSTS AND ESTATES 2 SH 001 LEC W 6:30-8:20PM GITT 214 FOURNARIS C MAX: 110 LAW -720 DEALS: ECON STRUC TRANS 3 SH 001 LEC MW 3-4:20PM SILV 240B D'AVINO R PERMISSION NEEDED FROM DEPARTMENT MAX: 25 LAW -723 FEDERAL INDIAN LAW 3 SH 001 LEC MW 10:30-11:50AM SILV 280 STRUVE C MAX: 40 LAW -729 FINANCIAL ACCT 3 SH 001 LEC MW 5:30-6:50PM GITT 1 DEFEO V MAX: 110 LAW -738 STRUCTURED FINANCE 2 SH 001 LEC M 4:30-6:20PM GITT 214 YARETT MAX: 110 LAW -743 COMPLEX LITIGATION 3 SH 001 LEC MW 9-10:20AM SILV 280 BURBANK S MAX: 40 LAW -744 ANALYTICAL METHODS 3 SH 001 LEC MW 10:30-11:50AM TANE 345 ABRAMS D MAX: 24 LAW -745 LEGISLATIVE CLINIC 7 SH 001 CLN M 4:30-6:30PM TANE 142 RULLI L PERMISSION NEEDED FROM DEPARTMENT MAX: 5 LAW -750 M&A THRU BUSINESS CYCLE 2 SH 001 LEC M 8:30-10:20AM GITT 214 CLAYTON,J PERMISSION NEEDED FROM DEPARTMENT MAX: 75 LAW -756 ADVANCED TORTS 3 SH 001 LEC TR 10:30-11:50AM SILV M28 AUSTIN R MAX: 18 LAW -757 CIVIL PRETRIAL LITIGATIO 3 SH 001 LEC MW 3-4:20PM SILV 52 POLLOCK J LEC MW 3-4:20PM SILV 53 MAX: 16 LAW -768 CORPORATE FINANCE 3 SH 001 LEC TR 1:30-2:50PM TANE 145 WACHTER M MAX: 110 LAW -769 CORP FIN: LEGAL ASPECTS 3 SH 001 LEC MW 10:30-11:50AM SILV 240A BRATTON W MAX: 80 LAW -773 ADV CORP: MERGERS & ACQ 3 SH 001 LEC TR 9-10:20AM GITT 214 ROCK E MAX: 110 LAW -782 CONSTITUTION AND FAMILY 3 SH 001 LEC MW 9-10:20AM SILV 240A ROBERTS D MAX: 80 LAW -789 LIT EMPL CLASS ACTIONS 2 SH 001 LEC T 4:30-6:20PM TANE 345 PUMA M MAX: 20 LAW -799 INTRO TO PHIL OF LAW 3 SH 001 LEC MW 3-4:20PM TANE 320 PERRY S MAX: 20 LAW -802 LAW REVIEW 0 TO 3 SH 001 IND TBA KATZ L LAW -803 LITTLETON FELLOWS 2 SH 001 IND M 12-1:20PM TANE 345 BARRETT E YEAR LONG COURSE LAW -804 MOOT COURT BOARD 2 SH 001 IND TBA BARRETT E YEAR LONG COURSE LAW -806 NAT'L MOOT COURT TEAM 2 SH 001 IND TBA BARRETT E LAW -808 EXTERN: LERNER CHILD WEL 2 SH 001 LEC TBA FINCK K PERMISSION NEEDED FROM DEPARTMENT MAX: 1 LAW -813 KEEDY CUP PRELIMINARIES 1 SH 001 IND TBA BARRETT E LAW -822 JOURN INTERNATIONAL LAW 0 TO 3 SH 001 IND TBA FELDMAN E LAW -824 EXTERN WOMEN'S LAW PROJ 4 SH 001 LEC TBA RULLI L MAX: 1 LAW -825 JOURN BUS LAW 0 TO 3 SH 001 IND TBA WACHTER M LAW -826 EXTERN: FED DEFENDER 7 SH 001 IND TBA GRANT B LAW -828 JOURN OF CONST'L LAW 0 TO 3 SH 001 IND TBA ROOSEVELT K LAW -830 EXTERN: C.L.S. 7 SH 001 SEM TBA PAOLETTI S PERMISSION NEEDED FROM DEPARTMENT MAX: 2 LAW -831 EXTERN: PHILA DIST ATTY 7 SH 001 SEM TBA KOSURI P PERMISSION NEEDED FROM DEPARTMENT MAX: 2 LAW -832 EAST ASIA LAW REVIEW 1 TO 3 SH 001 SEM TBA DELISLE J MAX: 30 LAW -834 EXTERN: E.P.A. 4 SH 001 IND TBA DAHL C PERMISSION NEEDED FROM DEPARTMENT LAW -835 EXTERN: US ATT'Y:CIVIL 7 SH 001 LEC TBA GREENBERG S PERMISSION NEEDED FROM DEPARTMENT MAX: 2 LAW -866 AD HOC EXTERNSHIP 3 TO 7 SH 001 LEC TBA BURKE-WHITE W MAX: 5 002 LEC TBA CHANG-MUY F MAX: 5 003 LEC TBA DAHL C MAX: 5 004 LEC TBA FINCK K MAX: 5 005 LEC TBA FISCH J MAX: 5 006 LEC TBA RUDOVSKY D MAX: 5 007 LEC TBA SKEEL D MAX: 5 008 LEC TBA SILVER C MAX: 5 009 LEC TBA YOO C MAX: 5 010 LEC TBA GELBACH J MAX: 5 LAW -875 JOURNAL LAW & SOCIAL CHG 0 TO 1 SH 001 IND TBA LESNICK H LAW -890 SCIENCES PO/PARIS 1 13 SH 001 LEC TBA OWENS L MAX: 4 LAW -896 EXTERN: FED APPELLATE 2 SH 001 LEC TBA RULLI L PERMISSION NEEDED FROM DEPARTMENT MAX: 3 LAW -902 GENERAL COUNSEL 3 SH 001 SEM W 6:30-8:30PM TANE 112 BIBEN M PERMISSION NEEDED FROM DEPARTMENT MAX: 18 LAW -905 PSYCH OF LEGAL DEC MKG 3 SH 001 SEM T 1-3PM SILV M28 WILKINSON-RYAN PERMISSION NEEDED FROM DEPARTMENT MAX: 20 LAW -906 CRIMINAL LAW RESEARCH GR 3 SH 001 LEC W 1-3PM SILV 52 ROBINSON P PERMISSION NEEDED FROM DEPARTMENT MAX: 6 LAW -909 RACE EDUC AND LAW 3 SH 001 SEM M 4:30-6:30PM TANE 253 SMITH-EVANS L MAX: 14 LAW -910 ANIMAL LAW & ETHICS 3 SH 001 SEM T 4:30-6:30PM SILV 280 ELLISON P MAX: 24 LAW -912 RIGHT TO COUNSEL 3 SH 001 SEM R 4:30-6:30PM SILV M28 BRINK M MAX: 14 LAW -914 INTERNET, STATE POWER 1 CU 401 SEM R 3-5PM ANNS 300 PRICE M CROSS LISTED: COMM-753 MAX W/CROSS LIST: 15 LAW -915 TRANSACTIONAL DRAFTING 3 SH 001 SEM W 4:30-6:30PM TANE 112 WILENSKY E PERMISSION NEEDED FROM DEPARTMENT MAX: 18 LAW -917 PROB IN LAW AND MORALITY 3 SH 001 SEM W 4:30-6:30PM SILV M28 KATZ L PERMISSION NEEDED FROM DEPARTMENT MAX: 18 LAW -920 PHARMA REG & ENFORCEMNT 3 SH 001 SEM R 6:30-8:30PM TANE 112 DAVAR M MAX: 14 LAW -922 JUDICIAL CLERKSHIP SEM 3 SH 001 SEM M 6:30-8:30PM TANE 122 JONES II C MAX: 14 LAW -926 LAWYERING/PUBLIC INT II 3 SH 002 SEM TBA FINKELSTEIN A PERMISSION NEEDED FROM DEPARTMENT MAX: 5 LAW -927 TAX POLICY 3 SH 001 SEM W 4:30-6:30PM GITT 213 SHULDINER R MAX: 20 LAW -928 INT'L COMMERCIAL ARBIT 3 SH 001 SEM R 4:30-6:30PM TANE 320 BEALE K PERMISSION NEEDED FROM DEPARTMENT MAX: 25 LAW -929 LGBT ISSUES IN HEALTH 3 SH 001 SEM T 4:30-6:30PM SILV 52 KONNOTH C MAX: 14 LAW -931 REGULATORY LAW & POL 3 SH 001 SEM W 4:30-6:30PM TANE 345 COGLIANESE C PERMISSION NEEDED FROM DEPARTMENT ADV REG LAW & POLICY 3 SH MAX: 14 002 SEM W 4:30-6:30PM TANE 345 COGLIANESE C PERMISSION NEEDED FROM DEPARTMENT MAX: 4 LAW -932 CRIM PRO IN HIST PERSP 3 SH 001 SEM M 6:30-8:30PM GK 330 MAYEUX S MAX: 14 LAW -933 PUBLIC INTEREST & ENTREP 3 SH 001 SEM R 6:30-8:30PM SILV 270 PRASAD S MAX: 14 LAW -934 PUBLIC HEALTH LAW 3 SH 001 SEM T 4:30-6:30PM TANE 142 FELDMAN E MAX: 18 LAW -937 PUBLIC POLICY SEM & WKSP 2 SH 001 SEM M 4:30-6:30PM SILV 270 BAKER T MAX: 14 LAW -940 STRATEGIC TRANS IN FASH 3 SH 001 SEM T 4:30-6:30PM TANE 320 HERZECA L PERMISSION NEEDED FROM DEPARTMENT MAX: 14 LAW -942 FIRST AMDT. IN 21ST CENT 3 SH 001 SEM W 4:30-6:30PM SILV 270 KREIMER S MAX: 16 LAW -943 DRUG PRODUCT LIABILITY 3 SH 001 SEM T 4:30-6:30PM TANE 145 GROSSI PERMISSION NEEDED FROM DEPARTMENT MAX: 30 LAW -945 GLOBAL RESEARCH SEMINAR 2 SH 001 SEM M 6:30-8:30PM TANE 320 BURKE-WHITE W MAX: 20 LAW -946 POL AUTH & POL OBL 3 SH 401 SEM T 4:30-6:30PM TANE 122 PERRY S CROSS LISTED: PHIL-577 SECTION MAX: 14 MAX W/CROSS LIST: 22 LAW -948 CRIMINAL LAW THEORY 3 SH 001 SEM W 4:30-6:30PM SILV M29 ROBINSON P MAX: 14 LAW -949 INT'L HUMAN RIGHTS 3 SH 001 SEM W 6:30-8:30PM TANE 142 PRADHAN A MAX: 18 LAW -950 CONTRACT DRAFTING 3 SH 001 SEM W 4:30-6:30PM TANE 320 PERMISSION NEEDED FROM DEPARTMENT MAX: 14 002 SEM T 6:30-8:30PM TANE 320 SCHLOSSBERG D PERMISSION NEEDED FROM DEPARTMENT MAX: 20 003 SEM W 4:30-6:30PM TANE 145 POLAK A PERMISSION NEEDED FROM DEPARTMENT MAX: 18 LAW -951 ADVANCED ISSUES IN CORP 1.5 SH 001 SEM W 4:30-6:30PM TANE 142 ROCK E MAX: 10 LAW -952 INTEL PROPERTY TRANSACTI 3 SH 001 LEC T 4:30-6:30PM TANE 253 BURTON D PERMISSION NEEDED FROM DEPARTMENT MAX: 14 LAW -957 WIDENING LENS CORP LAW 3 SH 001 SEM T 4:30-6:30PM TANE 112 WACHTER M MAX: 18 LAW -958 CYBERCRIME 3 SH 001 SEM M 4:30-6:30PM SILV M28 LEVY M PERMISSION NEEDED FROM DEPARTMENT MAX: 14 LAW -960 DEATH PENALTY 3 SH 001 SEM W 6:30-8:30PM TANE 345 SILVER S MAX: 18 LAW -961 CIVIL JUSTICE 3 SH 001 SEM W 6:30-8:30PM TANE 253 SPECTER S MAX: 20 LAW -962 PATENT LAW - APPELL AD 2 SH 001 SEM T 4:30-6:30PM GK 238 WAGNER R MAX: 6 LAW -966 INT.PROP.NAT'LECON.VALU 3 SH 001 SEM M 4:30-6:30PM GK 238 IMASOGIE O PERMISSION NEEDED FROM DEPARTMENT MAX: 10 LAW -967 WHITE COLLAR CRIME 3 SH 001 SEM M 6:30-8:30PM TANE 345 GOLUMBIC C PERMISSION NEEDED FROM DEPARTMENT MAX: 17 LAW -968 URBAN LAW: CONT LEGAL PR 3 SH 001 SEM T 4:30-6:30PM SILV M28 ARONCHICK MAX: 16 LAW -971 CLIENT LEVERAGE & LAW FI 3 SH 001 SEM F 12:30-2:30PM TANE 142 FRATTONE H PERMISSION NEEDED FROM DEPARTMENT MAX: 14 LAW -972 WRITING ABOUT THE LAW 3 SH 001 SEM R 4:30-6:30PM TANE 142 ROOSEVELT K PERMISSION NEEDED FROM DEPARTMENT MAX: 14 LAW -973 PARENTS CHILDREN & STATE 3 SH 001 SEM T 4:30-6:30PM GK 330 POKEMPNER J MAX: 10 LAW -974 DEF & ACH REG EXCELLENCE 2 SH 001 SEM R 12-1:20PM TANE 145 COGLIANESE C MAX: 14 LAW -979 VISUAL LEGAL ADVOCACY 2 SH 001 SEM TBA AUSTIN R AN ACADEMICALLY BASED COMMUNITY SERV COURSE MAX: 6 LAW -981 LAW AND NEUROSCIENCE 3 SH 001 SEM T 4:30-6:30PM SILV 270 MORSE S MAX: 14 LAW -988 JD/MBA CAPSTONE SEMINAR 1.5 SH 001 SEM R 4:30-6:30PM TANE 112 KNOLL M DATES: 03/02/15 - 04/24/15 MAX: 14 LAW -997 CONVICTION INTEGRITY 3 SH 001 SEM M 4:30-6:30PM TANE 112 HOLLWAY J MAX: 14
Return to Course & Room Roster
Comments to:
Office of the University Registrar
University of Pennsylvania
Room 221 Franklin Building
3451 Walnut Street
Philadelphia, PA 19104-6291
Phone:<PHONE_NUMBER> Fax:<PHONE_NUMBER>
<EMAIL_ADDRESS>Updated: Sat Jan 17 08:30:02 2015


Looking for information and statistics on anxiety and depression?
Would you like information on anxiety and depression compared to: Age, Gender, or Region?
Age
Gender
State
Percents of population that is experiencing Anxiety OR depression


title: ‘H0: R Refresher’ author: Natasha date: ‘2018-02-16’ slug: h0-r-refresher pre: “3. “
R uses different libraries or packages to load specific functions (read excel files, talk to Twitter, generate plots). You load a package or a library with the command:
# install package from RStudio console
# ** Note the quotation marks!
# install.packages("name_of_package")
# load package in enviromnet
library(blogdown)
In R, we assign values (numbers, characters, data frames) to objects (vectors, maricies, variables). To do so we use the “<-” operator:
# name_of_object = value
an_object <- 2
# inspect object's value
an_object
print(an_object)
another_object <- "some string"
Standard format for defining a function in R:
my_function_name <- function(arg1 = "default value", arg2 = "default value"){
# ... execution code goes here
merged_string <- paste(arg1, arg2) # 'paste' is used for concatenating strings
return(merged_string) # if not specified, last evaluated object is returned
}
# call a function elsewhere from code
arg1 <- "Hello"
arg2 <- "World!"
an_object <- my_function_name(arg1, arg2)
print(an_object)
R’s base data structures can be organised by their dimensionality (1d, 2d, or nd) and whether they’re homogeneous (all contents must be of the same type) or heterogeneous (the contents can be of different types). This gives rise to the five data types most often used in data analysis:
| Homogeneous | Heterogeneous | |
|---|---|---|
| 1d | Atomic vector | List |
| 2d | Matrix | Data frame |
| nd | Array |
Understand what data structures it’s composed of is to use str(). str() is short for structure and it gives a compact, human readable description of any R data structure.
The basic data structure in R is the vector. Vectors come in two flavours: atomic vectors and lists. They have three common properties:
There are four common types of atomic vectors: logical, integer, double (often called numeric), and character. Atomic vectors are usually created with c(), short for combine:
dbl_var <- c(1, 2.5, 4.5)
# With the L suffix, you get an integer rather than a double
int_var <- c(1L, 6L, 10L)
# Use TRUE and FALSE (or T and F) to create logical vectors
log_var <- c(TRUE, FALSE, T, F)
chr_var <- c("these are", "some strings")
int_var <- c(1L, 6L, 10L)
typeof(int_var)
is.integer(int_var)


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/update-mathlib.html ---
@Simon Hudon How far are we from having update-mathlib
work for mathlib itself (vs projects that depend on mathlib)?
You have cache-olean
for that
Huh? Did I miss something?
What is cache-olean
? Where do I get it? How much does it cost?
 If the branch you're checking out has a nightly, it will use it
Ok, so I ran cache-olean --fetch
in my mathlib
directory, and of course it didn't find a nightly on Github. Does this mean I will still have to recompile mathlib myself in 57% of the cases?
No way, more like 56% ...
What you can do is find a version that does have a nightly, do cache-olean --fetch
then checkout your branch and you should have less to rebuild
Sure... that does help a bit. But if the latest commits touch some basic files in the hierarchy (which does happen quite often) it is the difference between recompiling 70% or 60% of mathlib...
Anyway, I very much appreciate all the work you are doing to make these things easy for users. Maybe we can still find a place to host all these nightlies for us?
@Scott Morrison Can't you just run a cronjob to all the new nightlies from github every day...? That solves the "pushing to your server" issue, right?
Oh. I guess so.
So I'd just have a script that
1) pulls all branches on leanprover-community
2) runs cache-olean --build
in each of them
3) posts the resulting olean archive file somewhere public
and we'd update cache-olean --fetch
so that it also looks there
Ooh, I thought you might not even have to do the compiling...
After all Travis is already doing that.
Travis should just post them to some temporary space (e.g., Github)
I won't get to this immediately, but if someone wants to write that script for me (just a stub for step 3 is fine, I'll fill in scp to my server
)
You download them from Github.
That works too :-)
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


{{ pitch.title }} Category: {{ pitch.category }} Posted by {{ pitch.user.username }} {{ pitch.content }} Add your comment


The paper proposed a framework for joint modeling of labels and data by interpreting a discriminative classifier p(y|x) as an energy-based model p(x, y).
Joint modeling provides benefits like improved calibration (i.e., the predictive confidence should align with the miss classification rate), robustness, and out of order distribution.
Consider a standard classifier $f_{\theta}(x)$ which produces a k-dimensional vector of logits.
$p_{\theta}(y | x) = softmax(f_{\theta}(x)[y])$
Uisng concepts from energy based models, we write $p_{\theta}(x, y) = \frac{exp(-E_{\theta}(x, y))}{Z_{\theta}}$ where $E_{\theta}(x, y) = -f_{\theta}(x)[y]$
$p_{\theta}(x) = \sum_{y}{ \frac{exp(-E_{\theta}(x, y))}{Z_{\theta}}}$
$E_{\theta}(x) = -LogSumExp_y(f_{\theta}(x)[y])$
Note that in the standard discriminative setup, shiting the logits $f_{\theta}(x)$ does not affect the model but it affects $p_{\theta}(x)$.
Computing $p_{\theta}(y | x)$ using $p_{\theta}(x, y)$ and $p_{\theta}(x)$ gives back the same softmax parameterization as before.
This reinterpreted classifier is referred to as a Joint Energy-based Model (JEM).
The log-liklihood of the data can be factoized as $log p_{\theta}(x, y) = log p_{\theta}(x) + log p_{\theta}(y | x)$.
The second factor can be trained using the standard CE loss. In contrast, the first factor can be trained using a sampler based on Stochastic Gradient Langevin Dynamics.
Datasets: CIFAR10, CIFAR100, SVHN.
Metrics: Inception Score, Frechet Inception Distance
JEM outperforms generative, discriminative, and hybrid models on both generative and discriminative tasks.
A calibrated classifier is the one where the predictive confidence aligns with the misclassification rate.
Dataset: CIFAR100
JEM improves calibration while retaining high accuracy.
One way to detect OOD samples is to learn a density model that assigns a higher likelihood to in-distribution examples and lower likelihood to out of distribution examples.
JEM consistently assigns a higher likelihood to in-distribution examples.
The paper also proposes an alternate metric called approximate mass to detect OOD examples.
The intuition is that a point could have likelihood but be impossible to sample because its surroundings have a very low density.
On the other hand, the in-distribution data points would lie in a region of high probability mass.
Hence the norm of the gradient of log density could provide a useful signal to detect OOD examples.


Steiner believes F1 cars in 2021 will be just as fast as this season
by Tom MasonHaas boss Guenther Steiner feels that Formula One cars in 2021 will go as fast as the cars which have been used this season. From 2021, cars will be at least 25 kilos heavier in comparison to this season.
This comes from Pirelli's new 18-inch tires, which are heavier than the current ones, having a knock-on affect on the weight of the cars moving forward.
The minimum weight of the cars will go from 743 kilos to 768 kilos which will have an impact on the speed of the cars on a fast lap.
"No one wants heavier cars, and more in Formula 1, because that does not make cars as smooth as they drive," Steiner was quoted by F1 Only.
"With all the technology, security and hybrid technology you can not do otherwise. I do not think that the extra 25 kilos will be the most important factor to make cars slower, it will be more aerodynamics.
"I think at first we may not be where we want to be, but I'm pretty sure we'll find cars as fast as they are now. I think it will also depend a lot on the tires."
As a result, the cars are due to lose around 3 seconds a lap in 2021, compared to 2019 cars.


/*
* Copyright (c) AXA Shared Services Spain S.A.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const ConversationContext = require('./conversation-context');
/**
* In memory conversation context manager.
*/
class MemoryConversationContext extends ConversationContext {
/**
* Constructor of the class.
* @param {Object} settings Settings for the instance.
*/
constructor(settings) {
super(settings);
this.conversationContexts = {};
}
/**
* Gets the conversation context from the session.
* @param {Object} session Chatbot session of the conversation.
* @returns {Promise<Object>} Promise to resolve the conversation context.
*/
getConversationContext(session) {
return new Promise((resolve, reject) => {
const conversationId = this.getConversationId(session);
if (!conversationId) {
return reject(new Error('No conversation id found'));
}
if (!this.conversationContexts[conversationId]) {
this.conversationContexts[conversationId] = {};
}
return resolve(this.conversationContexts[conversationId]);
});
}
setConversationContext(session, context) {
return new Promise((resolve, reject) => {
const conversationId = this.getConversationId(session);
if (!conversationId) {
return reject(new Error('No conversation id found'));
}
this.conversationContexts[conversationId] = context;
return resolve();
});
}
}
module.exports = MemoryConversationContext;
|


--- type: "standard" title: "Conspiracy Theories That History Proved To Be True" description: "Conspiracy theories are only crazy until they are proven true." social_media_msg: "AAAAa" featimg: "http://images.dabannit.com/c0da0f/2016-03-23-true-conspiracy-theories.html-f02.png" origin_url: "http://www.viralnova.com/conspiracies-proven-right/" ---
People who believe in conspiracy theories are often treated as idiots.  While most conspiracy theories are plain false you will be amazed at how many ended up being true after enough time had passed.
This makes me wonder how 9/11 and JFK would turn out a few years from now.
Project MK-Ultra was the codename of a secret CIA project that started around 1950. It aimed at developing methods for mentally controlling individuals using psychotropic substances and bioelectrical signals. Rumors about MK-Ultra circulated for more than 20 years until 1975 when the project was revealed to the public thanks to a report by the New York Times and congressional and presidential investigations that followed.
Everybody knows today that Asbestos exposure is a direct cause of serious and often fatal health issues like mesothelioma, asbestosis and lung cance. But during the 1920s and 1930s construction companies who were heavily using the material considered the health hazards of Asbestos merely a conspiracy theory against their interests. Years later the effects of Asbestos on human health were proven and most countries around the world have banned the use of the mineral.
Between 1932 and 1972, the U.S. government run a nontherapeutic experiment on a group of 399 black men from Macon County, Alabama. These men were infected with syphilis and were being used as Laboratory Animals: the government had no intention of curing them from syphilis, instead they were intentionally left without treatment to study the effect of syphilis on black men as opposed to white men. When the study was finally revealed to the public in 1972, news reporter Harry Reasoner referred to it as a study that "used human beings as laboratory animals in a long and inefficient study of how long it takes syphilis to kill someone."
The Contras were Nicaraguan insurgents waging a guerrilla war against the Sandinista communist government backed by the Cubans. The conspiracy theory was that President Reagan facilitated the sale of US weapons to Iran to get them to help release American hostages from Iranian terrorists in Lebanon. And the proceeds from the sale were used to finance the Contras rebels in Nicaragua. Reagan denied such allegations in beginning but they were later proven true by commissions of investigators.
In the 1940s, a lot of urban legends and stories were circulating among Americans about the efforts of General Motors to monopolize transportation systems. Years later a court in California indicted not only General Motors but 8 other companies and 7 individuals on counts of conspiracy.
The Watergate scandal is an affair of political spying. It started on June 17th, 1972 after the arrest of burglars who broke into a building in Washington DC that housed the DNC. Journalists from the Washington Post link the burglars to President Nixon and his illegal financing of elections. In the beginning nobody trusted them and Nixon was reelected in November 1972. Two years later the truth is revealed and Nixon resigns.
General James Wilkinson was hailed as an American war hero during in 1812. A lot of people at the time accused him of working for the Spanish kingdom. Years after his death, his treason was discovered and he was condemned by all American Historians. Theodore Roosevelt once said "In all our history, there is no more despicable character."
Source: The Anti Media


Chapter 6 One-sample inference
6.1 Hunter-gatherers in Australia
A hunter-gatherer society is one where people get their food by hunting, fishing or foraging rather than by agriculture or by raising animals. Such societies tend to move from place to place. Anthropologists have studied hunter-gatherer societies in forest ecosystems across the world. The average population density of these societies is 7.38 people per 100 km\(^2\). Hunter-gatherer societies on different continents might have different population densities, possibly because of large-scale ecological constraints (such as resource availability), or because of other factors, possibly social and/or historic, determining population density.
Some hunter-gatherer societies in Australia were studied, and the population density per 100 km\(^2\) recorded for each. The data are in http://ritsokiguess.site/datafiles/hg.txt.
Read the data into R. Do you have the correct variables? How many hunter-gatherer societies in Australia were studied? Explain briefly.
The question of interest is whether these Australian hunter-gatherer societies are like the rest of the world in terms of mean population density. State suitable null and alternative hypotheses. Define any symbols you use: that is, if you use a symbol, you also have to say what it means.
Test your hypotheses using a suitable test. What do you conclude, in the context of the data?
Do you have any doubts about the validity of your test? Explain briefly, using a suitable graph to support your explanation.
6.2 Buses to Boulder
A bus line operates a route from Denver to Boulder (these places are in Colorado). The schedule says that the journey time should be 60 minutes. 11 randomly chosen journey times were recorded, and these are in the file link, with journey times shown in minutes.
Read the data into R, and display the data frame that you read in.
Run a suitable test to see whether there is evidence that the mean journey time differs from 60 minutes. What do you conclude? (I want a conclusion that says something about journey times of buses.)
Give a 95% confidence interval for the mean journey time. (No R code is needed here.)
Do you draw consistent conclusions from your test and confidence interval? Explain briefly.
Draw a boxplot of the journey times. Do you see a reason to doubt the test that you did above?
6.3 Length of gestation in North Carolina
The data in file link are about 500 randomly chosen births of babies in North Carolina. There is a lot of information: not just the weight at birth of the baby, but whether the baby was born prematurely, the ages of the parents, whether the parents are married, how long (in weeks) the pregnancy lasted (this is called the “gestation”) and so on. We have seen these data before.
Read in the data from the file into R, bearing in mind what type of file it is.
Find a 95% confidence interval for the mean birth weight of all babies born in North Carolina (of which these babies are a sample). At the end, you should state what the confidence interval is. Giving some output is necessary, but not enough by itself.
If your variable name has a space or other special character (like a question mark) in it, remember that you have to surround its name with backticks, as discussed the first time we looked at these data.
Birth weights of babies born in the United States have a mean of 7.3 pounds. Is there any evidence that babies born in North Carolina are less heavy on average? State appropriate hypotheses, do your test, obtain a P-value and state your conclusion, in terms of the original data.
The theory behind the \(t\)-test says that the distribution of birth weights should be (approximately) normally distributed. Obtain a histogram of the birth weights. Does it look approximately normal? Comment briefly. (You’ll have to pick a number of bins for your histogram first. I don’t mind very much what you pick, as long as it’s not obviously too many or too few bins.)
6.4 Inferring ice break-up in Nenana
Nenana, Alaska, is about 50 miles west of Fairbanks. Every spring, there is a contest in Nenana. A wooden tripod is placed on the frozen river, and people try to guess the exact minute when the ice melts enough for the tripod to fall through the ice. The contest started in 1917 as an amusement for railway workers, and has taken place every year since. Now, hundreds of thousands of people enter their guesses on the Internet and the prize for the winner can be as much as $300,000.
Because so much money is at stake, and because the exact same tripod is placed at the exact same spot on the ice every year, the data are consistent and accurate. The data are in link.
Yes, we saw these data before.
Read the data into R, as before, or use the data frame that you read in before. Note that the values are separated by tabs rather than spaces, so you’ll need an appropriate
read_
to read it in.Obtain a 90% confidence interval for the mean
JulianDate
. What interval do you get? Looking back at your histogram, do you have any doubts about the validity of what you have just done?An old-timer in Nenana strokes his grey beard and says “When I were young, I remember the tripod used to fall into the water around May 10”. In a non-leap year, May 10 is Julian day 130. Test the null hypothesis that the mean
JulianDay
is 130, against the alternative that it is less. What do you conclude? What practical implication does that have (assuming that the old-timer has a good memory)?Plot
JulianDate
againstYear
on a scatterplot. What recent trends, if any, do you see? Comment briefly. (You did this before, but I have some extra comments on the graph this time, so feel free to just read this part.)
6.5 Diameters of trees
The Wade Tract in Thomas County, Georgia, is an old-growth forest of longleaf pine trees. It has survived in a relatively undisturbed state since before settlements of the area by Europeans. For each tree in the tract, researchers measured the diameter at breast height. This is a standard measure in forestry: it is defined as the diameter of the tree at 4.5 feet above the ground.1 They are interested in the mean diameter at breast height of the trees in this tract. These values are in http://ritsokiguess.site/datafiles/treediameter.csv. The diameters are measured in centimetres. The easiest way to get the URL is to right-click on the blue text and select Copy URL. (If you copy and paste the actual text you might end up with extra spaces, especially if the printed URL goes over two lines.)
Read in and display (some of) the data.
Make a suitable plot of your dataframe.
Obtain a 95% confidence interval for the mean diameter.
Based on what you have seen so far, would you expect to reject a null hypothesis that the population mean diameter (of all longleaf pines like these) is 35 cm? Explain briefly. Then, carry out the test (against a two-sided alternative) and explain briefly whether you were right.
Would you expect 35 cm to be in a 99% confidence interval for the mean diameter? Explain briefly, and then see if you were right.
6.6 One-sample cholesterol
The data set here contains cholesterol measurements for heart attack patients (at several different times) as well as for a group of control patients. We will focus on the control patients in this question.
Read in and display (some of) the data.
Make a suitable plot of the cholesterol levels of the control patients, and comment briefly on the shape of the distribution.
It is recommended that people in good health, such as the Control patients here, keep their cholesterol level below 200. Is there evidence that the mean cholesterol level of the population of people of which the Control patients are a sample is less than 200? Show that you understand the process, and state your conclusion in the context of the data.
What values could the population mean cholesterol level take? You might need to get some more output to determine this.
Explain briefly why you would be reasonably happy to trust the \(t\) procedures in this question. (There are two points you need to make.)
My solutions follow:
6.7 Hunter-gatherers in Australia
A hunter-gatherer society is one where people get their food by hunting, fishing or foraging rather than by agriculture or by raising animals. Such societies tend to move from place to place. Anthropologists have studied hunter-gatherer societies in forest ecosystems across the world. The average population density of these societies is 7.38 people per 100 km\(^2\). Hunter-gatherer societies on different continents might have different population densities, possibly because of large-scale ecological constraints (such as resource availability), or because of other factors, possibly social and/or historic, determining population density.
Some hunter-gatherer societies in Australia were studied, and the population density per 100 km\(^2\) recorded for each. The data are in http://ritsokiguess.site/datafiles/hg.txt.
- Read the data into R. Do you have the correct variables? How many hunter-gatherer societies in Australia were studied? Explain briefly.
Solution
The data values are separated by (single) spaces, so read_delim
is the thing:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## name = col_character(),
## density = col_double()
## )
I like to put the URL in a variable first, because if I don’t, the
read_delim
line can be rather long. But if you want to do it
in one step, that’s fine, as long as it’s clear that you are doing the
right thing.
Let’s look at the data frame:
## # A tibble: 13 x 2
## name density
## <chr> <dbl>
## 1 jeidji 17
## 2 kuku 50
## 3 mamu 45
## 4 ngatjan 59.8
## 5 undanbi 21.7
## 6 jinibarra 16
## 7 ualaria 9
## 8 barkindji 15.4
## 9 wongaibon 5.12
## 10 jaralde 40
## 11 tjapwurong 35
## 12 tasmanians 13.4
## 13 badjalang 13.4
I have the name of each society and its population density, as promised (so that is correct). There were 13 societies that were studied. For me, they were all displayed. For you, you’ll probably see only the first ten, and you’ll have to click Next to see the last three.
\(\blacksquare\)
- The question of interest is whether these Australian hunter-gatherer societies are like the rest of the world in terms of mean population density. State suitable null and alternative hypotheses. Define any symbols you use: that is, if you use a symbol, you also have to say what it means.
Solution
The mean for the world as a whole (“average”, as stated earlier) is 7.38. Let \(\mu\) denote the population mean for Australia (of which these societies are a sample). Then our hypotheses are: \[ H_0: \mu=7.38\] and \[ H_a: \mu \ne 7.38.\] There is no reason for a one-sided alternative here, since all we are interested in is whether Australia is different from the rest of the world. Expect to lose a point if you use the symbol \(\mu\) without saying what it means.
\(\blacksquare\)
- Test your hypotheses using a suitable test. What do you conclude, in the context of the data?
Solution
A \(t\)-test, since we are testing a mean:
##
## One Sample t-test
##
## data: societies$density
## t = 3.8627, df = 12, p-value = 0.002257
## alternative hypothesis: true mean is not equal to 7.38
## 95 percent confidence interval:
## 15.59244 36.84449
## sample estimates:
## mean of x
## 26.21846
The P-value is 0.0023, less than the usual \(\alpha\) of 0.05, so we reject the null hypothesis and conclude that the mean population density is not equal to 7.38. That is to say, Australia is different from the rest of the world in this sense.
As you know, “reject the null hypothesis” is only part of the answer, so gets only part of the marks.
\(\blacksquare\)
- Do you have any doubts about the validity of your test? Explain briefly, using a suitable graph to support your explanation.
Solution
The assumption behind the \(t\)-test is that the data are approximately normal. We can assess that in several ways, but the simplest (which is perfectly acceptable at this point) is a histogram. You’ll need to pick a suitable number of bins. This one comes from Sturges’ rule:
Your conclusion might depend on how many bins you chose for your histogram. Here’s 8 bins (which is really too many with only 13 observations, but it actually shows the shape well):
or you can get a number of bins from one of the built-in functions, such as:
## [1] 3
This one is small. The interquartile range is large and \(n\) is small, so the binwidth will be large and therefore the number of bins will be small.
Other choices: a one-group boxplot:
This isn’t the best for assessing normality as such, but it will tell you about lack of symmetry and outliers, which are the most important threats to the \(t\)-test, so it’s fine here. Or, a normal quantile plot:
This is actually the best way to assess normality, but I’m not expecting you to use this plot here, because we may not have gotten to it in class yet. (If you have read ahead and successfully use the plot, it’s fine.)
After you have drawn your chosen plot (you need one plot), you need to say something about normality and thus whether you have any doubts about the validity of your \(t\)-test. This will depend on the graph you drew: if you think your graph is symmetric and outlier-free, you should have no doubts about your \(t\)-test; if you think it has something wrong with it, you should say what it is and express your doubts. My guess is that you will think this distribution is skewed to the right. Most of my plots are saying that.2
On the website where I got these data, they were using the data as an example for another test, precisely because they thought the distribution was right-skewed. Later on, we’ll learn about the sign test for the median, which I think is actually a better test here.
\(\blacksquare\)
6.8 Buses to Boulder
A bus line operates a route from Denver to Boulder (these places are in Colorado). The schedule says that the journey time should be 60 minutes. 11 randomly chosen journey times were recorded, and these are in the file link, with journey times shown in minutes.
- Read the data into R, and display the data frame that you read in.
Solution
Since you can read the data directly from the URL, do that (if
you are online) rather than having to copy and paste and save,
and then find the file you saved.
Also, there is only one column, so you can pretend that there
were multiple columns, separated by whatever you like. It’s least
typing to pretend that they were separated by commas like a
.csv
file:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## minutes = col_double()
## )
## # A tibble: 11 x 1
## minutes
## <dbl>
## 1 58
## 2 61
## 3 69
## 4 62
## 5 81
## 6 54
## 7 72
## 8 71
## 9 53
## 10 54
## 11 66
Using read_delim
with any delimiter (such as " "
)
will also work, and is thus also good.
Variable names in R can have a dot (or an underscore, but not a space) in them. I have grown accustomed to using dots to separate words. This works in R but not other languages, but is seen by some as old-fashioned, with underscores being the modern way.3 You can also use what is called “camel case” by starting each “word” after the first with an uppercase letter like this:
You have to get the capitalization and punctuation right when you use your variables,
no matter what they’re called. In any of the cases above, there is no
variable called journeytimes
. As Jenny Bryan (in
link)
puts it, boldface in original:
Implicit contract with the computer / scripting language: Computer
will do tedious computation for you. In return, you will be
completely precise in your instructions. Typos matter. Case
matters. Get better at typing.
\(\blacksquare\)
- Run a suitable test to see whether there is evidence that the mean journey time differs from 60 minutes. What do you conclude? (I want a conclusion that says something about journey times of buses.)
Solution
t.test
doesn’t take a data=
to say which
data frame to use. Wrap it in a with
:
##
## One Sample t-test
##
## data: minutes
## t = 1.382, df = 10, p-value = 0.1971
## alternative hypothesis: true mean is not equal to 60
## 95 percent confidence interval:
## 57.71775 69.73680
## sample estimates:
## mean of x
## 63.72727
We are testing that the mean journey time is 60 minutes, against the two-sided alternative (default) that the mean is not equal to 60 minutes. The P-value, 0.1971, is a lot bigger than the usual \(\alpha\) of 0.05, so we cannot reject the null hypothesis. That is, there is no evidence that the mean journey time differs from 60 minutes.
As you remember, we have not proved that the mean journey time is 60 minutes, which is what “accepting the null hypothesis” would be. We have only failed to reject it, in a shoulder-shrugging kind of way: “the mean journey time could be 60 minutes”. The other acceptable word is “retain”; when you say “we retain the null hypothesis”, you imply something like “we act as if the mean is 60 minutes, at least until we find something better.”
\(\blacksquare\)
- Give a 95% confidence interval for the mean journey time. (No R code is needed here.)
Solution
Just read it off from the output: 57.72 to 69.74 minutes.
\(\blacksquare\)
- Do you draw consistent conclusions from your test and confidence interval? Explain briefly.
Solution
The test said that we should not reject a mean of 60 minutes. The confidence interval says that 60 minutes is inside the interval of plausible values for the population mean, which is another way of saying the same thing. (If we had rejected 60 as a mean, 60 would have been outside the confidence interval.)
\(\blacksquare\)
- Draw a boxplot of the journey times. Do you see a reason to doubt the test that you did above?
Solution
The grouping variable is a “nothing” as in the Ken and Thomas question (part (d)):
The assumption behind the \(t\)-test is that the population from which the data come has a normal distribution: ie. symmetric with no outliers. A small sample (here we have 11 values) even from a normal distribution might look quite non-normal (as in Assignment 0 from last week), so I am not hugely concerned by this boxplot. However, it’s perfectly all right to say that this distribution is skewed, and therefore we should doubt the \(t\)-test, because the upper whisker is longer than the lower one. In fact, the topmost value is very nearly an outlier:4
and there might be skewness as well, so maybe I should have been concerned.
I would be looking for some intelligent comment on the boxplot: what it looks like vs. what it ought to look like. I don’t so much mind what that comment is, as long as it’s intelligent enough.
Perhaps I should draw a normal quantile plot:
The normal quantile plot is saying that the problem is actually at the bottom of the distribution: the lowest value is not low enough, but the highest value is actually not too high. So this one seems to be on the edge between OK and being right-skewed (too bunched up at the bottom). My take is that with this small sample this is not too bad. But you are free to disagree.
If you don’t like the normality, you’d use a sign test and test that the median is not 60 minutes, which you would (at my guess) utterly fail to reject:
## $above_below
## below above
## 4 7
##
## $p_values
## alternative p_value
## 1 lower 0.8867187
## 2 upper 0.2744141
## 3 two-sided 0.5488281
## [1] 54.00195 71.99023
and so we do. The median could easily be 60 minutes.
\(\blacksquare\)
6.9 Length of gestation in North Carolina
The data in file link are about 500 randomly chosen births of babies in North Carolina. There is a lot of information: not just the weight at birth of the baby, but whether the baby was born prematurely, the ages of the parents, whether the parents are married, how long (in weeks) the pregnancy lasted (this is called the “gestation”) and so on. We have seen these data before.
- Read in the data from the file into R, bearing in mind what type of file it is.
Solution
This is a .csv
file (it came from a spreadsheet), so it
needs reading in accordingly. Work directly from the URL (rather
than downloading the file, unless you are working offline):
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## `Father Age` = col_double(),
## `Mother Age` = col_double(),
## `Weeks Gestation` = col_double(),
## `Pre-natal Visits` = col_double(),
## `Marital Status` = col_double(),
## `Mother Weight Gained` = col_double(),
## `Low Birthweight?` = col_double(),
## `Weight (pounds)` = col_double(),
## `Premie?` = col_double(),
## `Few Visits?` = col_double()
## )
\(\blacksquare\)
- Find a 95% confidence interval for the mean birth weight of all babies born in North Carolina (of which these babies are a sample). At the end, you should state what the confidence interval is. Giving some output is necessary, but not enough by itself.
If your variable name has a space or other special character (like a question mark) in it, remember that you have to surround its name with backticks, as discussed the first time we looked at these data.
Solution
This:
##
## One Sample t-test
##
## data: bw$`Weight (pounds)`
## t = 104.94, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 6.936407 7.201093
## sample estimates:
## mean of x
## 7.06875
or (the same, but remember to match your brackets):
##
## One Sample t-test
##
## data: Weight (pounds)
## t = 104.94, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 6.936407 7.201093
## sample estimates:
## mean of x
## 7.06875
The confidence interval goes from 6.94 to 7.20 pounds.
There is an annoyance about t.test
. Sometimes you can use
data=
with it, and sometimes not. When we do a two-sample
\(t\)-test later, there is a “model formula” with a squiggle in it,
and there we can use data=
, but here not, so you have to use
the dollar sign or the with
to say which data frame to get
things from. The distinction seems to be that if you are using a
model formula, you can use data=
, and if not, not.
This is one of those things that is a consequence of R’s history. The
original t.test
was without the model formula and thus
without the data=
, but the model formula got “retro-fitted”
to it later. Since the model formula comes from things like
regression, where data=
is legit, that had to be retro-fitted
as well. Or, at least, that’s my understanding.
\(\blacksquare\)
- Birth weights of babies born in the United States have a mean of 7.3 pounds. Is there any evidence that babies born in North Carolina are less heavy on average? State appropriate hypotheses, do your test, obtain a P-value and state your conclusion, in terms of the original data.
Solution
Let \(\mu\) be the population mean (the mean weight of all babies born in North Carolina). Null hypothesis is \(H_0: \mu=7.3\) pounds, and the alternative is that the mean is less: \(H_a: \mu<7.3\) pounds.
Note that I defined \(\mu\) first before I used it.
This is a one-sided
alternative, which we need to feed into t.test
:
##
## One Sample t-test
##
## data: bw$`Weight (pounds)`
## t = -3.4331, df = 499, p-value = 0.0003232
## alternative hypothesis: true mean is less than 7.3
## 95 percent confidence interval:
## -Inf 7.179752
## sample estimates:
## mean of x
## 7.06875
$ %$
Or with with
. If you see what I mean.
The P-value is 0.0003, which is less than any \(\alpha\) we might have chosen: we reject the null hypothesis in favour of the alternative, and thus we conclude that the mean birth weight of babies in North Carolina is indeed less than 7.3 pounds.
“Reject the null hypothesis” is not a complete answer. You need to say something about what rejecting the null hypothesis means in this case: that is, you must make a statement about birth weights of babies.
\(\blacksquare\)
- The theory behind the \(t\)-test says that the distribution of birth weights should be (approximately) normally distributed. Obtain a histogram of the birth weights. Does it look approximately normal? Comment briefly. (You’ll have to pick a number of bins for your histogram first. I don’t mind very much what you pick, as long as it’s not obviously too many or too few bins.)
Solution
We did this before (and discussed the number of bins before), so I’ll just reproduce my 10-bin histogram (which is what I preferred, but this is a matter of taste):
So, we were assessing normality. What about that?
It is mostly normal-looking, but I am suspicious about those very low birth weights, the ones below about 4 pounds. There are too many of those, as I see it.
If you think this is approximately normal, you need to make some comment along the lines of “the shape is approximately symmetric with no outliers”. I think my first answer is better, but this answer is worth something, since it is a not completely unreasonable interpretation of the histogram.
A normal quantile plot is better for assessing normality than a histogram is, but I won’t make you do one until we have seen the idea in class. Here’s the normal quantile plot for these data:
This is rather striking: the lowest birthweights (the ones below 5 pounds or so) are way too low for a normal distribution to apply. The top end is fine (except perhaps for that one very heavy baby), but there are too many low birthweights for a normal distribution to be believable. Note how much clearer this story is than on the histogram.
Having said that, the \(t\)-test, especially with a sample size as big as this (500), behaves very well when the data are somewhat non-normal (because it takes advantage of the Central Limit Theorem: that is, it’s the sampling distribution of the sample mean whose shape matters). So, even though the data are definitely not normal, I wouldn’t be too worried about our test.
This perhaps gives some insight as to why Freedman-Diaconis said we should use so many bins for our histogram. We have a lot of low-end outliers, so that the IQR is actually small compared to the overall spread of the data (as measured, say, by the SD or the range) and so FD thinks we need a lot of bins to describe the shape. Sturges is based on data being approximately normal, so it will tend to produce a small number of bins for data that have outliers.
\(\blacksquare\)
6.10 Inferring ice break-up in Nenana
Nenana, Alaska, is about 50 miles west of Fairbanks. Every spring, there is a contest in Nenana. A wooden tripod is placed on the frozen river, and people try to guess the exact minute when the ice melts enough for the tripod to fall through the ice. The contest started in 1917 as an amusement for railway workers, and has taken place every year since. Now, hundreds of thousands of people enter their guesses on the Internet and the prize for the winner can be as much as $300,000.
Because so much money is at stake, and because the exact same tripod is placed at the exact same spot on the ice every year, the data are consistent and accurate. The data are in link.
Yes, we saw these data before.
- Read the data into R, as before, or use the data frame that
you read in before. Note that the values are separated by
tabs rather than spaces, so you’ll need an appropriate
read_
to read it in.
Solution
These are “tab-separated values”, so read_tsv
is the
thing, as for the Australian athletes:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## Year = col_double(),
## JulianDate = col_double(),
## `Date&Time` = col_character()
## )
Use whatever name you like for the data frame. One that is different
from any of the column headers is smart; then it is clear whether you
mean the whole data frame or one of its columns. ice
or
melt
or anything like that would also be good.
\(\blacksquare\)
- Obtain a 90% confidence interval for the mean
JulianDate
. What interval do you get? Looking back at your histogram, do you have any doubts about the validity of what you have just done?
Solution
This is a matter of using t.test
and pulling out the
interval. Since we are looking for a non-standard interval, we
have to remember conf.level
as the way to get the
confidence level that we want. I’m going with with
this
time, though the dollar-sign thing is equally as good:
##
## One Sample t-test
##
## data: JulianDate
## t = 197.41, df = 86, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 90 percent confidence interval:
## 124.4869 126.6018
## sample estimates:
## mean of x
## 125.5443
Between 124.5 and 126.6 days into the year. Converting that into something we can understand (because I want to), there are \(31+28+31+30=120\) days in January through April (in a non-leap year), so this says that the mean breakup date is between about May 4 and May 6.
The \(t\)-test is based on an assumption of data coming from a normal distribution. The histogram we made earlier looks pretty much normal, so there are no doubts about normality and thus no doubts about the validity of what we have done, on the evidence we have seen so far. (I have some doubts on different grounds, based on another of the plots we did earlier, which I’ll explain later, but all I’m expecting you to do is to look at the histogram and say “Yep, that’s normal enough”. Bear in mind that the sample size is 87, which is large enough for the Central Limit Theorem to be pretty helpful, so that we don’t need the data to be more than “approximately normal” for the sampling distribution of the sample mean to be very close to \(t\) with the right df.)
\(\blacksquare\)
- An old-timer in Nenana strokes his grey beard and says
“When I were young, I remember the tripod used to fall into the water around May 10”.
In a non-leap year, May 10 is Julian day 130. Test the null hypothesis that the
mean
JulianDay
is 130, against the alternative that it is less. What do you conclude? What practical implication does that have (assuming that the old-timer has a good memory)?
Solution
The test is t.test
again, but this time we have to
specify a null mean and a direction of alternative:
##
## One Sample t-test
##
## data: JulianDate
## t = -7.0063, df = 86, p-value = 2.575e-10
## alternative hypothesis: true mean is less than 130
## 95 percent confidence interval:
## -Inf 126.6018
## sample estimates:
## mean of x
## 125.5443
For a test, look first at the P-value, which is 0.0000000002575: that
is to say, the P-value is very small, definitely smaller than 0.05 (or
any other \(\alpha\) you might have chosen). So we reject the
null hypothesis, and conclude that the mean JulianDate
is actually
less than 130.
Now, this is the date on which the ice breaks up on average, and we have concluded that it is earlier than it used to be, since we are assuming the old-timer’s memory is correct.
This is evidence in favour of global warming; a small piece of evidence, to be sure, but the ice is melting earlier than it used to all over the Arctic, so it’s not just in Nenana that it is happening. You don’t need to get to the “global warming” part, but I do want you to observe that the ice is breaking up earlier than it used to.
\(\blacksquare\)
- Plot
JulianDate
againstYear
on a scatterplot. What recent trends, if any, do you see? Comment briefly. (You did this before, but I have some extra comments on the graph this time, so feel free to just read this part.)
Solution
I liked the ggplot
with a smooth trend on it:
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
There was something obvious to see: after about 1960, there is a clear
downward trend: the ice is breaking up earlier on average every
year. Even though there is a lot of variability, the overall trend,
viewed this way, is clear (and consistent with the test we did
earlier). Note that the old-timer’s value of 130 is the kind of
JulianDate
we would typically observe around 1920, which
would make the old-timer over 90 years old.
All right, why did I say I had some doubts earlier? Well, because of
this downward trend, the mean is not actually the same all the way
through, so it doesn’t make all that much sense to estimate it, which
is what we were doing earlier by doing a confidence interval or a
hypothesis test. What would actually make more sense is to estimate
the mean JulianDate
for a particular year. This could
be done by a regression: predict JulianDate
from
Year
, and then get a
“confidence interval for the mean response”
(as you would have seen in B27 or will see in C67). The
trend isn’t really linear, but is not that far off. I can modify the
previous picture to give you an idea. Putting in method="lm"
fits a line; as we see later, lm
does regressions in R:
## `geom_smooth()` using formula 'y ~ x'
Compare the confidence interval for the mean JulianDate
in
1920: 126 to 131 (the shaded area on the graph), with 2000: 121 to
125. A change of about 5 days over 80 years. And with the recent trend
that we saw above, it’s probably changing faster than that
now. Sobering indeed.
\(\blacksquare\)
6.11 Diameters of trees
The Wade Tract in Thomas County, Georgia, is an old-growth forest of longleaf pine trees. It has survived in a relatively undisturbed state since before settlements of the area by Europeans. For each tree in the tract, researchers measured the diameter at breast height. This is a standard measure in forestry: it is defined as the diameter of the tree at 4.5 feet above the ground.5 They are interested in the mean diameter at breast height of the trees in this tract. These values are in http://ritsokiguess.site/datafiles/treediameter.csv. The diameters are measured in centimetres. The easiest way to get the URL is to right-click on the blue text and select Copy URL. (If you copy and paste the actual text you might end up with extra spaces, especially if the printed URL goes over two lines.)
- Read in and display (some of) the data.
Solution
The obvious way is this:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## diameter = col_double()
## )
## # A tibble: 40 x 1
## diameter
## <dbl>
## 1 10.5
## 2 13.3
## 3 26
## 4 18.3
## 5 52.2
## 6 9.2
## 7 26.1
## 8 17.6
## 9 40.5
## 10 31.8
## # … with 30 more rows
Call the data frame what you like, though it is better to use a name that tells you what the dataframe contains (rather than something like mydata
).
Extra 1: there is only one column, so you can pretend the columns are separated by anything at all. Thus you could use this:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## diameter = col_double()
## )
## # A tibble: 40 x 1
## diameter
## <dbl>
## 1 10.5
## 2 13.3
## 3 26
## 4 18.3
## 5 52.2
## 6 9.2
## 7 26.1
## 8 17.6
## 9 40.5
## 10 31.8
## # … with 30 more rows
or even this:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## diameter = col_double()
## )
## # A tibble: 40 x 1
## diameter
## <dbl>
## 1 10.5
## 2 13.3
## 3 26
## 4 18.3
## 5 52.2
## 6 9.2
## 7 26.1
## 8 17.6
## 9 40.5
## 10 31.8
## # … with 30 more rows
Extra 2: you might be wondering how they measure the diameter without doing something like drilling a hole through the tree. They don’t actually measure the diameter at all. What they measure is the circumference of the tree, which is easy enough to do with a tape measure. Longleaf pines are usually near circular, so you get the diameter by taking the circumference and dividing by \((a)i\). This City of Portland website shows you how it’s done.
\(\blacksquare\)
- Make a suitable plot of your dataframe.
Solution
One quantitative variable, so a histogram. Choose a sensible number of bins. There are 40 observations, so a number of bins up to about 10 is good. Sturges’ rule says 6 since \(2^6=64\):
Extra 1: comments come later, but you might care to note (if only for yourself) that the distribution is a little skewed to the right, or, perhaps better, has no left tail at all. You might even observe that diameters cannot be less than 0 (they are measurements), and so you might expect a skew away from the limit.
After you’ve looked at the \(t\) procedures for these data, we’ll get back to the shape.
Extra 2: later we look at a more precise tool for assessing normality, the normal quantile plot, which looks like this:
If the data come from a normal distribution, the points should follow the straight line, at least approximately. Here, most of the points do, except for the points on the left, which veer away upwards from the line: that is, the highest values, on the right, are about right for a normal distribution, but the lowest values, on the left, don’t go down low enough.6 Thus, the problem with normality is not the long tail on the right, but the short one on the left. It is hard to get this kind of insight from the histogram, but at the moment, it’s the best we have.
The big problems, for things like \(t\)-tests that depend on means, is stuff like outliers, or long tails, with extreme values that might distort the mean. Having short tails, as the left tail here, will make the distribution look non-normal but won’t cause any problems for the \(t\)-tests.
\(\blacksquare\)
- Obtain a 95% confidence interval for the mean diameter.
Solution
This is t.test
, but with conf.level
to get the interval (and then you ignore the P-value):
##
## One Sample t-test
##
## data: diameter
## t = 9.748, df = 39, p-value = 5.245e-12
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 21.6274 32.9526
## sample estimates:
## mean of x
## 27.29
The mean diameter of a longleaf pine (like the ones in this tract) is between 21.6 and 33.0 centimetres.
If you prefer, do it this way:
##
## One Sample t-test
##
## data: trees$diameter
## t = 9.748, df = 39, p-value = 5.245e-12
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 21.6274 32.9526
## sample estimates:
## mean of x
## 27.29
You need to state the answer and round it off suitably. The actual diameters in the data have one decimal place, so you can give the same accuracy for the CI, or at most two decimals (so 21.63 to 32.95 cm would also be OK).7 Giving an answer with more decimals is something you cannot possibly justify. Worse even than giving too many decimals is not writing out the interval at all. Never make your reader find something in output. If they want it, tell them what it is.
Thus, here, one mark for the output, one more for saying what the interval is, and the third if you give the interval with a sensible number of decimals.
\(\blacksquare\)
- Based on what you have seen so far, would you expect to reject a null hypothesis that the population mean diameter (of all longleaf pines like these) is 35 cm? Explain briefly. Then, carry out the test (against a two-sided alternative) and explain briefly whether you were right.
Solution
The logic is that “plausible” values for the population mean, ones you believe, are inside the interval, and implausible ones that you don’t believe are outside. Remember that the interval is your best answer to “what is the population mean”, and 35 is outside the interval so you don’t think the population mean is 35, and thus you would reject it.
Are we right? Take out the conf.level
and put in a mu
:
##
## One Sample t-test
##
## data: diameter
## t = -2.754, df = 39, p-value = 0.008895
## alternative hypothesis: true mean is not equal to 35
## 95 percent confidence interval:
## 21.6274 32.9526
## sample estimates:
## mean of x
## 27.29
The P-value is less than our \(\alpha\) of 0.05, so we would indeed reject a mean of 35 cm (in favour of the mean being different from 35).
\(\blacksquare\)
- Would you expect 35 cm to be in a 99% confidence interval for the mean diameter? Explain briefly, and then see if you were right.
Solution
The P-value is less than 0.01 (as well as being less than 0.05), so, in the same way that 35 was outside the 95% interval, it should be outside the 99% CI also. Maybe not by much, though, since the P-value is only just less than 0.01:
##
## One Sample t-test
##
## data: diameter
## t = 9.748, df = 39, p-value = 5.245e-12
## alternative hypothesis: true mean is not equal to 0
## 99 percent confidence interval:
## 19.70909 34.87091
## sample estimates:
## mean of x
## 27.29
Indeed so, outside, but only just.
\(\blacksquare\)
6.12 One-sample cholesterol
The data set here contains cholesterol measurements for heart attack patients (at several different times) as well as for a group of control patients. We will focus on the control patients in this question.
- Read in and display (some of) the data.
Solution
This is (as you might guess) a , so:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## `2-Day` = col_double(),
## `4-Day` = col_double(),
## `14-Day` = col_double(),
## control = col_double()
## )
## # A tibble: 30 x 4
## `2-Day` `4-Day` `14-Day` control
## <dbl> <dbl> <dbl> <dbl>
## 1 270 218 156 196
## 2 236 234 NA 232
## 3 210 214 242 200
## 4 142 116 NA 242
## 5 280 200 NA 206
## 6 272 276 256 178
## 7 160 146 142 184
## 8 220 182 216 198
## 9 226 238 248 160
## 10 242 288 NA 182
## # … with 20 more rows
Note for yourself that there are 30 observations (and some missing ones), and a column called that is the one we’ll be working with.
Extra: the 2-day, 4-day and 14-day columns need to be referred to with funny “backticks” around their names, because a column name cannot contain a -
or start with a number. This is not a problem here, since we won’t be using those columns, but if we wanted to, this would not work:
## Error: Problem with `summarise()` column `xbar`.
## ℹ `xbar = mean(2 - Day)`.
## ✖ error in evaluating the argument 'x' in selecting a method for function 'mean': object 'Day' not found
because it is looking for a column called Day
, which doesn’t exist. The meaning of 2-Day
is “take the column called Day
and subtract it from 2”. To make this work, we have to supply the backticks ourselves:
## # A tibble: 1 x 1
## xbar
## <dbl>
## 1 254.
This column also has missing values (at the bottom), so here I’ve asked to remove the missing values8 before working out the mean. Otherwise the mean is, unhelpfully, missing as well.
You might imagine that dealing with column names like this would get annoying. There is a package called janitor
that has a function called clean_names
to save you the trouble. Install it first, then load it:
and then pipe your dataframe into clean_names
and see what happens:
## # A tibble: 30 x 4
## x2_day x4_day x14_day control
## <dbl> <dbl> <dbl> <dbl>
## 1 270 218 156 196
## 2 236 234 NA 232
## 3 210 214 242 200
## 4 142 116 NA 242
## 5 280 200 NA 206
## 6 272 276 256 178
## 7 160 146 142 184
## 8 220 182 216 198
## 9 226 238 248 160
## 10 242 288 NA 182
## # … with 20 more rows
These are all legit column names; the -
has been replaced by an underscore, and each of the first three column names has gained an x
on the front so that it no longer starts with a number. This then works:
## # A tibble: 1 x 1
## xbar
## <dbl>
## 1 254.
\(\blacksquare\)
- Make a suitable plot of the cholesterol levels of the control patients, and comment briefly on the shape of the distribution.
Solution
There is one quantitative variable, so a histogram, as ever:
Pick a number of bins that shows the shape reasonably well. Too many or too few won’t. (Sturges’ rule says 6, since there are 30 observations and \(2^5=32\).) Seven bins also works, but by the time you get to 8 bins or more, you are starting to lose a clear picture of the shape. Four bins is, likewise, about as low as you can go before getting too crude a picture.
Choosing one of these numbers of bins will make it clear that the distribution is somewhat skewed to the right.
\(\blacksquare\)
- It is recommended that people in good health, such as the Control patients here, keep their cholesterol level below 200. Is there evidence that the mean cholesterol level of the population of people of which the Control patients are a sample is less than 200? Show that you understand the process, and state your conclusion in the context of the data.
Solution
The word “evidence” means to do a hypothesis test and get a P-value. Choose an \(\alpha\) first, such as 0.05.
Testing a mean implies a one-sample \(t\)-test. We are trying to prove that the mean is less than 200, so that’s our alternative: \(H_a: \mu < 200\), and therefore the null is that the mean is equal to 200: \(H_0: \mu = 200\). (You might think it makes more logical sense to have \(H_0: \mu \ge 200\), which is also fine. As long as the null hypothesis has an equals in it in a logical place, you are good.)
##
## One Sample t-test
##
## data: control
## t = -1.6866, df = 29, p-value = 0.05121
## alternative hypothesis: true mean is less than 200
## 95 percent confidence interval:
## -Inf 200.0512
## sample estimates:
## mean of x
## 193.1333
This is also good:
##
## One Sample t-test
##
## data: cholest$control
## t = -1.6866, df = 29, p-value = 0.05121
## alternative hypothesis: true mean is less than 200
## 95 percent confidence interval:
## -Inf 200.0512
## sample estimates:
## mean of x
## 193.1333
I like the first version better because a lot of what we do later involves giving a data frame, and then working with things in that data frame. This is more like that.
This test is one-sided because we are looking for evidence of less; if the mean is actually more than 200, we don’t care about that. For a one-sided test, R requires you to say which side you are testing.
The P-value is not (quite) less than 0.05, so we cannot quite reject the null. Therefore, there is no evidence that the mean cholesterol level (of the people of which the control group are a sample) is less than 200. Or, this mean is not significantly less than 200. Or, we conclude that this mean is equal to 200. Or, we conclude that this mean could be 200. Any of those.
If you chose a different \(\alpha\), draw the right conclusion for the \(\alpha\) you chose. For example, with \(\alpha=0.10\), we do have evidence that the mean is less than 200. Being consistent is more important than getting the same answer as me.
Writing out all the steps correctly shows that you understand the process. Anything less doesn’t.
\(\blacksquare\)
- What values could the population mean cholesterol level take? You might need to get some more output to determine this.
Solution
This is not quoting the sample mean, giving that as your answer, and then stopping. The sample mean should, we hope, be somewhere the population mean, but it is almost certainly not the same as the population mean, because there is variability due to random sampling. (This is perhaps the most important thing in all of Statistics: recognizing that variability exists and dealing with it.)
With that in mind, the question means to get a range of values that the population mean could be: that is to say, a confidence interval. The one that came out of the previous output is one-sided, to go with the one-sided test, but confidence intervals for us are two-sided, so we have to run the test again, but two-sided, to get it. To do that, take out the “alternative”, thus (you can also take out the null mean, since a confidence interval has no null hypothesis):
##
## One Sample t-test
##
## data: control
## t = 47.436, df = 29, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 184.8064 201.4603
## sample estimates:
## mean of x
## 193.1333
With 95% confidence, the population mean cholesterol level is between 184.8 and 201.5.
You need to state the interval, and you also need to round off the decimal places to something sensible. This is because in your statistical life, you are providing results to someone else in a manner that they can read and understand. They do not have time to go searching in some output, or to fish through some excessive number of decimal places. If that’s what you give them, they will ask you to rewrite your report, wasting everybody’s time when you could have done it right the first time.
How many decimal places is a good number? Look back at your data. In this case, the cholesterol values are whole numbers (zero decimal places). A confidence interval is talking about a mean. In this case, we have a sample size of 30, which is between 10 and 100, so we can justify one extra decimal place beyond the data, here one decimal altogether, or two at the absolute outside. (Two is more justifiable if the sample size is bigger than 100.) See, for example, this, in particular the piece at the bottom.
\(\blacksquare\)
- Explain briefly why you would be reasonably happy to trust the \(t\) procedures in this question. (There are two points you need to make.)
Solution
The first thing is to look back at the graph you made earlier. This was skewed to the right (“moderately” or “somewhat” or however you described it). This would seem to say that the \(t\) procedures were not very trustworthy, since the population distribution doesn’t look very normal in shape.
However, the second thing is to look at the sample size. We have the central limit theorem, which says (for us) that the larger the sample is, the less the normality matters, when it comes to estimating the mean. Here, the sample size is 30, which, for the central limit theorem, is large enough to overcome moderate non-normality in the data.
My take, which I was trying to guide you towards, is that our non-normality was not too bad, and so our sample size is large enough to trust the \(t\) procedures we used.
Extra 1: What matters is the tradeoff between sample size and the extent of the non-normality. If your data is less normal, you need a larger sample size to overcome it. Even a sample size of 500 might not be enough if your distribution is very skewed, or if you have extreme outliers.
The place \(n=30\) comes from is back from the days when we only ever used printed tables. In most textbooks, if you printed the \(t\)-table on one page in a decent-sized font, you’d get to about 29 df before running out of space. Then they would say “\(\infty\) df” and put the normal-distribution \(z\) numbers in. If the df you needed was bigger than what you had in the table, you used this last line: that is, you called the sample “large”. Try it in your stats textbooks: I bet the df go up to 30, then you get a few more, then the \(z\) numbers.
Extra 2: By now you are probably thinking that this is very subjective, and so it is. What actually matters is the shape of the thing called the sampling distribution of the sample mean. That is to say, what kind of sample means you might get in repeated samples from your population. The problem is that you don’t know what the population looks like.9 But we can fake it up, in a couple of ways: we can play what-if and pretend we know what the population looks like (to get some understanding for “populations like that”), or we can use a technique called the “bootstrap” that will tell us what kind of sample means we might get from the population that our sample came from (this seems like magic and, indeed, is).
The moral of the story is that the central limit theorem is more powerful than you think.
To illustrate my first idea, let’s pretend the population looks like this, with a flat top:
Only values between 0 and 1 are possible, and each of those is equally likely. Not very normal in shape. So let’s take some random samples of size three, not in any sense a large sample, from this “uniform” population, and see what kind of sample means we get. This technique is called simulation: rather than working out the answer by math, we’re letting the computer approximate the answer for us. Here’s one simulated sample:
## [1] 0.9475841 0.1245953 0.2277288
## [1] 0.4333027
and here’s the same thing 1000 times, including a histogram of the sample means:
tibble(sim = 1:1000) %>%
rowwise() %>%
mutate(my_sample = list(runif(3))) %>%
mutate(my_mean = mean(my_sample)) %>%
ggplot(aes(x = my_mean)) + geom_histogram(bins = 12)
This is our computer-generated assessment of what the sampling distribution of the sample mean looks like. Isn’t this looking like a normal distribution?
Let’s take a moment to realize what this is saying. If the population looks like the flat-topped uniform distribution, the central limit theorem kicks in for a sample of size three, and thus if your population looks like this, \(t\) procedures will be perfectly good for \(n=3\) or bigger, even though the population isn’t normal.
Thus, when you’re thinking about whether to use a \(t\)-test or something else (that we’ll learn about later), the distribution shape matters, but so does the sample size.
I should say a little about my code. I’m not expecting you to figure out details now (we see the ideas properly in simulating power of tests), but in words, one line at a time:
- generate 1000 (“many”) samples each of 3 observations from a uniform distribution
- for each sample, work out the mean of it
- turn those sample means into a data frame with a column called
value
- make a histogram of those.
Now, the central limit theorem doesn’t always work as nicely as this, but maybe a sample size of 30 is large enough to overcome the skewness that we had:
That brings us to my second idea above.
The sample that we had is in some sense an “estimate of the population”. To think about the sampling distribution of the sample mean, we need more estimates of the population. How might we get those? The curious answer is to sample from the sample. This is the idea behind the bootstrap. (This is what Lecture 3c is about.) The name comes from the expression “pulling yourself up by your own bootstraps”, meaning “to begin an enterprise or recover from a setback without any outside help” (from here), something that should be difficult or impossible. How is it possible to understand a sampling distribution with only one sample?
We have to be a bit careful. Taking a sample from the sample would give us the original sample back.  Here, the original data had values 160 and 162 that are missing in the bootstrap sample; the original data had one value 166, but the bootstrap sample has four! I sorted the data and the bootstrap sample to make this clearer; you will not need to sort. This is a perfectly good bootstrap sample:
## [1] 242 232 198 160 242 182 182 182 198 162 212 198 242 204 242 242 170 198 182 206 232 170 218 188 166 178 164 160 218 196
So now we know what to do: take lots of bootstrap samples, work out the mean of each, plot the means, and see how normal it looks. The only new idea here is the sampling with replacement:
tibble(sim = 1:1000) %>%
rowwise() %>%
mutate(my_sample = list(sample(cholest$control, replace = TRUE))) %>%
mutate(my_mean = mean(my_sample)) %>%
ggplot(aes(x = my_mean)) + geom_histogram(bins = 12)
That looks pretty normal, not obviously skewed, and so the \(t\) procedures we used will be reliable enough.
\(\blacksquare\)
The height of a typical human breast off the ground. Men have a breast too, you know.↩
The normal quantile plot is rather interesting: it says that the uppermost values are approximately normal, but the smallest eight or so values are too bunched up to be normal. That is, normality fails not because of the long tail on the right, but the bunching on the left. Still right-skewed, though.↩
In some languages, a dot is used to concatenate bits of text, or as a way of calling a method on an object. But in R, a dot has no special meaning, and is used in function names like
t.test
. Orp.value
.↩Whether you think it is or not may depend on how many bins you have on your histogram. With 5 bins it looks like an outlier, but with 6 it does not. Try it and see.↩
The height of a typical human breast off the ground. Men have a breast too, you know.↩
They cannot go down far enough, because they can’t go below zero.↩
One more decimal place than the data is the maximum you give in a CI.↩
In R, missing values are labelled
NA
, andrm
is Unix/C shorthand for remove.↩If you did, all your problems would be over.↩


{% trans "Please login to continue." %}
{% endif %}{% blocktrans with identities_link as link %}If you already have an account, you can associate a social identity in the identities page in your account settings (after you login).{% endblocktrans %}


Morning Coffee
Page Title
Is there anything more satisfying...
Did you know?:
Bullet Point #1
Bullet Point #2
Bullet Point #3
Three Great Coffee Shops
Link:
Coava Coffee


Since its creation, Git has become an immensely popular Distributed Source Control System. It allows you to track changes in your files while simplifying collaborative work on files and projects both for individuals and companies.
People often confuse Git and GitHub, but they are quite different things. Github is a centralized cloud server that allows you to store your code in repositories. It also allows you to interact with other developers on Open Source Projects.
The main focus of this lesson is to not only give you a proper foundation in Git, but also to serve as an inspiration for further learning. By the end of this session, we should be able to push a simple hangman python sketch to github from our computer terminal.Now that we know a basic concept of Git, lets move on to the next part: Installing Git
Unless you are a windows user, getting git setup on your device is very easy from the command line:
sudo apt-get install git
git version
you will get the option to download x code or to just install git, for now, let's just install git. Go ahead and click the install button
python-hangman
seems decent enough
Now that we have an Account on Github lets update our credentials in the command line locally. To do that, we
use the git config
command for that. We want these configurations to be saved on our computer
so that we don't have to set it up everytime we want to use git. So we'll pass it the --global
option.
git config --global user.name "yourUserNameHere"
This command will set your username gobally. Next, let's setup our email globally too.
git config --global user.email<EMAIL_ADDRESS>With that done, let's navigate into our hangman project directory and manage it with git. Click here to download the hangman project file.
Git doesn't automatically determine which files or projects to manage on your computer. In order to manage your
project with git, you need to initialize an instance of git in the project directory.
To do that, we'll use the init
command.
git init
With git initialized, let's check the status of our project directory. This will tell us about the files in our project directory and their state in relation to git.
git status
Let's add our hangman.py to git locally.
git add hangman.py
Next, we'll record the state of our repository now ("Which in this case is the state of our hangman.py file"). We will add a message to describe the state of our repo or what changes we made. We will use the commit
command in git, and give it the message -m
option.
git commit -m "added main project file"
Now, let's try to push our repository to Github.
First we need to set our remote. A remote is git's fancy way of saying The Place where your code is stored. Copy the link to the repositor you created on github.
git remote add origin https://github.com/yourUsername/repository.git
With our remote added, we can now push the repository to github.
git push -u origin master
| Command | Meaning |
|---|---|
git diff |
Shows differences that haven't been staged |
git reset [filename] |
Unstages the file, but preseves it contents |
git rm [filename] |
Deletes the file from our working directory and removes it from git too. Note: you will have to run git commit afterwards to delete the file |
git pull |
Downloads all commits that are in your Github repository. |


[all packages]
[package ]
[class hierarchy]
[index]
public class PremonEnvironment
(source file: PremonEnvironment.java)
java.lang.Object
|
+----PremonEnvironment
The pure class interface.
public class PremonEnvironment
-
A class which contains the `environment' of a Premon applet.
A premon applet is called with four arguments:
The base context (the nodes in the graph).
The free variables (the incoming edges of the graph).
The expression (the graph).
A flag to say whether the graph should be drawn with a
control line or not.
This information is stored as a parsed syntax tree, and as a
desugared and typechecked syntax tree.
In addition, the current font and font metrics are stored,
as well as the graph (as a constraint set) and the solution to
the constraints. These allow the graph to be drawn.
- Author:
- Alan Jeffrey
- Version: v1.0 1998/06/02
- PremonEnvironment(Applet)
-
Initialize the fields.
- constructors
-
The sugared constructors.
- constructorsDesugared
-
The desugared constructors.
- context
-
The sugared context.
- contextDesugared
-
The desugared context.
- d
-
The graph as a constraint set.
- isRed
-
Should the graph contain a control line?
- s
-
The solution to the constraints.
- term
-
The sugared term.
- termDesugared
-
The desugared term.
- textFont
-
The text font for the graph.
- textFontMetrics
-
The text font metrics for the graph.
PremonEnvironment
public PremonEnvironment(Applet parent);
-
Initialize the fields.
- Parameters:
- parent - The applet which created the context (necessary
in order to get the parameters and find the fonts).
context
public PremonJJTCon context;
-
The sugared context.
constructors
public PremonJJTCon constructors;
-
The sugared constructors.
term
public PremonJJTExp term;
-
The sugared term.
contextDesugared
public PremonCon contextDesugared;
-
The desugared context.
constructorsDesugared
public PremonCon constructorsDesugared;
-
The desugared constructors.
termDesugared
public PremonExp termDesugared;
-
The desugared term.
isRed
public boolean isRed;
-
Should the graph contain a control line?
textFont
public Font textFont;
-
The text font for the graph.
textFontMetrics
public FontMetrics textFontMetrics;
-
The text font metrics for the graph.
d
public Drawable d;
-
The graph as a constraint set.
s
public Solution s;
-
The solution to the constraints.
[all packages]
[package ]
[class hierarchy]
[index]
PremonEnvironment.html


Before Change
obs = env.reset()
terminal = False
i = 0
while not terminal and i < 5:
action = env.action_space.sample()
next_obs, reward, terminal, _ = env.step(action)
replay_buffer_inserter(
replay_buffer, obs, action, reward, terminal, log_prob=0.0
)
obs = next_obs
After Change
def test_cartpole(self):
env = gym.make("CartPole-v0")
replay_buffer, inserted = _create_replay_buffer_and_insert(env)
batch = replay_buffer.sample_transition_batch_tensor(indices=np.array([0]))
npt.assert_array_almost_equal(
inserted[0]["observation"], batch.state.squeeze(0)
)
npt.assert_array_almost_equal(


Introduction to
Apache Spark
Apache Spark 2.4.0
Spark Core
- RDD is the main abstraction of Apache Spark
-
Resilient
-
Distributed
-
Dataset
-
In-Memory, Immutable, Lazy Evaluated, Partitioned, Cacheable, Parallel, Typed
-
CAUTION: Don't use directly. Too low-level. Leave it alone until you really really want it. Even then, think twice.
Spark SQL
-
Distributed SQL Engine for Structured Data Processing
-
SQL Interface
- Dataset and DataFrame
-
DataFrame is a type alias for Dataset of Rows.
-
Query DSL
-
Hive Support
-
UDF - User-Defined Functions
-
Aggregation and Window Operators
Spark MLlib
-
Large-Scale Distributed Machine Learning
-
"Making practical machine learning scalable and easy"
-
DataFrame-based API
- Pipeline API for designing, evaluating, and tuning machine learning pipelines
- Classification, Regression, Clustering, Recommendation, Collaborative Filtering, ...
-
Model Import / Export
Spark Structured Streaming


Charlize Theron honoured for her 'fearless' career in Hollywood
Hollywood - Charlize Theron was honoured by Hollywood Friday for a "fearless" career in which she tackled themes including sexual harassment long before the #MeToo movement up-ended the industry.
The 44-year-old South African Oscar-winner, who has often played down her flawless looks to win darker, more complex parts, collected the prestigious American Cinematheque Award at a Beverly Hills gala.
"I'm overwhelmed - I need a cocktail!" she told AFP as stars including Kristen Stewart, Seth Rogen, and David Oyelowo gathered to honour her career.
"These people who are here tonight have been with me through a lot of stuff."
Theron won the best actress Academy Award in 2004 with her turn as prostitute and serial killer Aileen Wuornos in Monster.
She earned Hollywood's respect with a visceral performance which saw her pack on 30 pounds (14 kg) and render herself unrecognisable with makeup and prosthetics to play the unappealing murderer.
"She is the most fearless actor I've ever worked with, and probably the most fearless human being I've ever met," said Jason Reitman, who directed Theron in Young Adult and Tully.
Next month Theron appears in another transformative role - as former TV anchor Megyn Kelly in Bombshell, which depicts the downfall of Fox News co-founder Roger Ailes after a sexual harassment scandal.
"When I read (the script) it felt like it was part of a conversation that was happening now. And that to me, felt really important," she said.
In contrast, her 2005 turn as a miner who files the United States' first class-action sexual harassment lawsuit in North Country came at a time when Hollywood turned a blind eye to such issues.
Back then there was a sense that sexual harassment "was in the past and that it's been dealt with," said Theron.
The part earned her a second Oscar nod. A decade later, the #MeToo movement swept through Hollywood.
(Compiled by Graye Morkel)


WITNESS LIST Corrections Committee February 11, 2003-8:00A Adult/juv criminal justice system On: Fabelo, Tony (Criminal Justice Policy Council) Correctional Managed Health Care On: Hightower, Allen (Correctional Managed Health Care) Sapp, Allen (Correctional Managed Health Care) Enhanced Mental Health Services On: Lovelace, Joe (National Alliance for the Mentally Ill (NAMI Texas)) Overview of probation/county jail On: Lee, Donald (Texas Conference of Urban Counties) Parole rates On: Garrett, Gerald (Texas Board of Pardons and Paroles) Prison system overview On: del Llano, Ann (A.C.L.U. of Texas) Texas Youth Commission On: Robinson, Steve (Texas Youth Commission) Tx Juvenile Probation Commission On: Spriggs, Vicki (Texas Juvenile Probation Commission) TDCJ Population/Budget On: Johnson, Gary (Texas Department of Criminal Justice)


WITNESS LIST State Bond Revenues, Select Committee July 11, 2002-1:30P Interim Charge On: Buie, Jim (Texas Bond Review Board) Carlson, Claire (Adjutant General's Department) Edwards, Kimberly (Texas Public Finance Authority) Smith, Zelma (Legislative Budget Board) Stanford, John (Adjutant General's Department)


Seabras-1 submarine network operational with Infinera XTS-3300 meshponders
Seaborn Networks has announced that its Seabras-1 submarine network, which links Brazil and New York, is operational. The company also has revealed that it is using XTS-3300 meshponders from Infinera (NASDAQ:INFN) to support the delivery of low-latency, flexible-capacity services. The 10,600-km, six-fiber-pair Seabras-1 undersea cable system offers direct connectivity between São Paulo, Brazil, and New York City – the only submarine cable to do so, asserts Larry W. Schwartz, chairman and CEO of Seaborn. The subsea system also includes provisions for branching units for connectivity to Virginia Beach, Miami, St. Croix, Fortaleza, Rio de Janeiro, southern Brazil, and Cape Town. None of these branching units are currently under construction, Schwartz says.
Stephen Hardy


Home
Contact
Menu
Pagination
Contact Us
We love hearing from our Guests! Let us know how we can help.
Enter Name:
Enter Email:
Your Comment:
Submit


| I l@ve RuBoard |
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects.
The animal on the cover of Python Programming on Win32 is a caiman (caiman crocodilus). One of 23 species of crocodiles, the caiman lives primarily in the wetlands, flood plains, and river areas of Mexico and South America. They prefer less-traveled, low waters. Their diet consists of insects, fish, and small mammals.
A female builds a nest in the ground or in covered vegetation, and lays around 20 to 25 eggs in the late summer. Several females may share a nest, to help their young survive. After 90 days' gestation, the young hatch. They reach full maturity at around four to seven years of age. A caiman grows to be about four to six feet long.
Caiman young are yellow in color, while adults have a more olive-green color. In the past, caimans have been in danger due to habitat destruction, hunting, and pet trade, but some conservation efforts have helped bring their numbers up in recent years.
Mary Anne Weeks Mayo was the production editor for Python Programming on Win32. Colleen Gorman copyedited the book, and Jeff Holcomb and Jane Ellin provided quality control. Judy Hoer provided production assistance. Robert Romano and Rhon Porter created the illustrations using Adobe Photoshop 4 and Macromedia FreeHand 7. Brenda Miller wrote the index.
Edie Freedman designed the cover of this book, using a 19th-century engraving from the Dover Pictorial Archive. The cover layout was produced with Quark XPress 3.32 using the ITC Garamond font.
Kathleen Wilson produced the cover layout with Quark XPress 3.3 using Adobe's ITC Garamond font. The interior layouts were designed by Edie Freedman and Nancy Priest, with modifications by Alicia Cech, and implemented in FrameMaker 5.5 by Mike Sierra. The text and heading fonts are ITC Garamond Light and Garamond Book. This colophon was written by Nicole Arigo.
| I l@ve RuBoard |