DSCI 325: Handout 24 Introduction to Writing Functions in R Spring 2017
|
|
- Frank Flowers
- 5 years ago
- Views:
Transcription
1 DSCI 325: Handout 24 Introduction to Writing Functions in R Spring 2017 We have already used several existing R functions in previous handouts. For example, consider the Grades dataset. Once the data frame has been attached in R, we can call the mean() function as follows to compute the average of the Final Exam scores. > mean(final) [1] We can also call the median() function. > median(final) [1] 72 Before we discuss writing new functions in R, let s examine an existing function more closely. For more insight into the coding behind the median() function, consider the following R commands and output. > median function (x, na.rm = FALSE) UseMethod("median") <bytecode: 0x b265d20> <environment: namespace:stats> > methods(median) [1] median.default > median.default function (x, na.rm = FALSE) { if (is.factor(x) is.data.frame(x)) stop("need numeric data") if (length(names(x))) names(x) <- NULL if (na.rm) x <- x[!is.na(x)] else if (any(is.na(x))) return(x[false][na]) n <- length(x) if (n == 0L) return(x[false][na]) half <- (n + 1L)%/%2L if (n%%2l == 1L) sort(x, partial = half)[half] else mean(sort(x, partial = half + 0L:1L)[half + 0L:1L]) When determining how to use this function, note that this function contains two arguments: x and na.rm. For more information on these arguments, enter the following at the prompt. > help(median) 1
2 Description Compute the sample median. Usage median(x, na.rm = FALSE) Arguments x an object for which a method has been defined, or a numeric vector containing the values whose median is to be computed. na.rm a logical value indicating whether NA values should be stripped before the computation proceeds. Notice that by default, the na.rm argument is set to FALSE. This means that the following arguments both return the same result: > median(final) [1] 72 > median(final,na.rm=false) [1] 72 The previous example gives us some insight into how functions are programmed with arguments and called in R. You can learn a lot about R programming by examining the code behind functions that were written by others, and before you know it, you ll be writing your own. The remainder of this handout provides an introduction to the basics of writing your own functions in R. WRITING NEW FUNCTIONS IN R One of the advantages of using a scriptable language like R is the ability to write your own functions (or to modify existing functions). An R programmer can define their own functions using the function() and return() functions. Description These functions provide the base mechanisms for defining new functions in the R language. Usage function( arglist ) expr return(value) 2
3 Arguments arglist Empty or one or more name or name=expression terms. expr An expression. value An expression. Example 1: Creating a function to add two numbers Note that the sum() function already exists in R and can be used to add two numbers; for illustrative purposes, however, we will write our own simple function to do this. add_two <- function(a,b){ a+b To call the function, enter the following at the prompt. > add_two(3,9) [1] 12 Example 2: Creating a function to compute multiple quantities Next, suppose you want to write a function in R to both find the difference between two values and the ratio of those two values. You may start with the following. f1 <- function(a,b){ a-b a/b > f1(.5,.25) [1] 2 Note that the function returns the result of only the last of the computations. To report all of the results, you can use the return statement as shown below. f1 <- function(a,b){ return(c(a-b,a/b)) > f1(.5,.25) [1] Finally, note that it may be more useful to assign names to the values calculated and to return a more flexible data type (such as a list object) to provide more information about the calculations that have been performed. The following programming statements return the results in a list. 3
4 f1 <- function(a,b){ Result1 = a-b Result2 = a/b list(difference=result1,ratio=result2) > f1(.5,.25) $Difference [1] 0.25 $Ratio [1] 2 Example 3: Computing the mean of a vector of numbers Once again, note that the mean() function already exists in R and can be used to find the average of a vector of numbers; for illustrative purposes, however, we will write our own simple function to do this. Suppose we want to name our function average. We can check to make sure that this is not already a keyword in R (we wouldn t want to overwrite an existing function!). >?average No documentation for average in specified packages and libraries: you could try??average Next, we can write the function as follows. average <- function(x){ s = sum(x) avg = s/length(x) return (avg) Note that this function can now be applied to calculate the average of the final exam scores from the Grades data frame. > attach(grades) > average(final) [1] Example 4: Computing the standard error of the mean and dealing with missing values Recall that the standard error of a sample mean is computed as follows: s n, where s is the sample standard deviation and n is the sample size. The R base package does not contain a function to compute this standard error, so let s write our own function named sem(). 4
5 sem <- function(x){ n = length(x) se = sd(x)/sqrt(n) return (se) > sem(final) [1] Next, import the data file Grades_missing. Note that in one case, a student did not take the final exam. > Grades_missing[1:3,c("FirstName", "LastName", "Final")] FirstName LastName Final 1 Aaron Albrecht 63 2 Aaron Alen 51 3 Abbey Antoff NA What impact will this have on using our sem() function? > sem(final) [1] NA Clearly, our function does not work with missing data. How do we fix it? First, let s remove the old function from our workspace. > rm(sem) Now, we can update our function. sem <- function(x){ n = length(na.omit(x)) se = sd(x,na.rm=true)/sqrt(n) return (se) > sem(final) [1] Example 5: Modifying the summary() function Recall that the summary() function can be used to calculate several summary statistics for the final exam scores. > detach(grades_missing) > attach(grades) > summary(final) Min. 1st Qu. Median Mean 3rd Qu. Max
6 What if you would also like to see the standard deviation, sample size, and standard error of the mean? You can write your own function to add to the output provided by the summary() function. Here, we will name this revised function num.summary. num.summary <- function(x){ original = summary(x) s = sd(x,na.rm=true) n=length(na.omit(x)) se=s/sqrt(n) list(c(original,"std Dev" = s, "Sample Size" = n, "SE of mean" = se)) > num.summary(final) [[1]] Min. 1st Qu. Median Mean 3rd Qu. Max. Std Dev Sample Size SE of mean Finally, note that you could change the layout of the output, if desired. num.summary <- function(x){ Min = summary(x)[1] Q1 = summary(x)[2] Q2 = summary(x)[3] Q3 = summary(x)[5] Max = summary(x)[6] Mean = summary(x)[4] s = sd(x,na.rm=true) n=length(na.omit(x)) se=s/sqrt(n) cat(paste("min: ", Min)) cat(paste("q1: ", Q1)) cat(paste("median: ", Q2)) cat(paste("q3: ", Q3)) cat(paste("max: ", Max)) cat(paste("mean: ", Mean)) cat(paste("standard Deviation: ", s)) cat(paste("sample Size: ", n)) cat(paste("standard Error: ", se)) > num.summary(final) Min: 0 Q1: Median: 72 Q3: 83 Max: 100 Mean: Standard Deviation: Sample Size: 134 Standard Error:
7 Example 6: Modifying the plot() function Suppose you want the plot() function to use a smaller gray-filled circle as the default plotting symbol instead of an open circle. You can modify the existing plot()function as follows. Note that you can pass an unspecified number of parameters to a function using the notation; however, when using the notation, be sure to carefully consider the order of the arguments in the list. my.plot <- function(..., pch.new=21, bg.new='gray', cex.new=.75 ) { plot(..., pch=pch.new, bg=bg.new, cex=cex.new ) > my.plot(exam1,final) > plot(exam1,final) 7
8 Tasks: 1. Recall that the formula for a sphere is 4 3πr 3. Write a function named sphere.volume that returns the volume of a sphere when given the radius r as a parameter. Then, call the function to return the volume of a sphere with a radius of 5. Call the function again to return the volume of a sphere with a radius of Write a function named my.plot which calls the plot() function but uses a blue open circle as the default plotting symbol, instead. Use your function to obtain a scatterplot of Exam 1 vs. Exam 2 scores from the Grades data set. 3. Recall that the syntax for the by() function. Usage by(data, INDICES, FUN,..., simplify = TRUE) Arguments data an R object, normally a data frame, possibly a matrix. INDICES a factor or a list of factors, each of length nrow(data). FUN a function to be applied to (usually data-frame) subsets of data.... further arguments to FUN. Suppose you always mess up the order of the arguments because you think it makes more sense to list the arguments in this order, instead: (1) the function to be applied, (2) the data frame (or subset of a data frame) to which you want to apply the function, and (3) the BY factor. Write a function named my.by() which allows you to enter the arguments in the order you desire. Then, import the NYC_trees data set. Use your my.by() function to compute the mean Foliage Density for each Condition. 8
DSCI 325: Handout 4 If-Then Statements in SAS Spring 2017
DSCI 325: Handout 4 If-Then Statements in SAS Spring 2017 IF-THEN STATEMENTS IN SAS We have already worked briefly with IF-THEN statements in SAS. Here, we will discuss using IF-THEN statements in a DATA
More informationStatistics 251: Statistical Methods
Statistics 251: Statistical Methods Summaries and Graphs in R Module R1 2018 file:///u:/documents/classes/lectures/251301/renae/markdown/master%20versions/summary_graphs.html#1 1/14 Summary Statistics
More informationDSCI 325: Handout 3 Creating and Redefining Variable in SAS Spring 2017
DSCI 325: Handout 3 Creating and Redefining Variable in SAS Spring 2017 Content Source: The Little SAS Book, Chapter 3, by L. Delwiche and S. Slaughter. CREATING NEW VARIABLES OR REDEFINING VARIABLES In
More informationCorrelation. January 12, 2019
Correlation January 12, 2019 Contents Correlations The Scattterplot The Pearson correlation The computational raw-score formula Survey data Fun facts about r Sensitivity to outliers Spearman rank-order
More informationWriting Functions! Part I!
Writing Functions! Part I! In your mat219_class project 1. Create a new R script or R notebook called wri7ng_func7ons 2. Include this code in your script or notebook: library(tidyverse) library(gapminder)
More informationStatistical Programming Camp: An Introduction to R
Statistical Programming Camp: An Introduction to R Handout 5: Loops and Conditional Statements Fox Chapter 2, 8 In this handout, we cover the following new materials: Using loops for(i in X){ to repeat
More informationDensity Curve (p52) Density curve is a curve that - is always on or above the horizontal axis.
1.3 Density curves p50 Some times the overall pattern of a large number of observations is so regular that we can describe it by a smooth curve. It is easier to work with a smooth curve, because the histogram
More informationMATH& 146 Lesson 8. Section 1.6 Averages and Variation
MATH& 146 Lesson 8 Section 1.6 Averages and Variation 1 Summarizing Data The distribution of a variable is the overall pattern of how often the possible values occur. For numerical variables, three summary
More informationENGR Fall Exam 1
ENGR 1300 Fall 01 Exam 1 INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..
More informationGetting Started in R
Getting Started in R Phil Beineke, Balasubramanian Narasimhan, Victoria Stodden modified for Rby Giles Hooker January 25, 2004 1 Overview R is a free alternative to Splus: a nice environment for data analysis
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College September 6, 2017 Outline Outline 1 Chapter 2: Data Abstraction Outline Chapter 2: Data Abstraction 1 Chapter 2: Data Abstraction
More informationCSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)
Name: Email address: Quiz Section: CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will
More informationMidterm Examination , Fall 2011
Midterm Examination 36-350, Fall 2011 Instructions: Provide all answers in your bluebook. Only work in the bluebook will be graded. Clearly indicate which problem each answer goes with. There are 100 points
More informationStatistical Programming with R
Statistical Programming with R Lecture 5: Simple Programming Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester 1 Functions
More informationA. Incorrect! This would be the negative of the range. B. Correct! The range is the maximum data value minus the minimum data value.
AP Statistics - Problem Drill 05: Measures of Variation No. 1 of 10 1. The range is calculated as. (A) The minimum data value minus the maximum data value. (B) The maximum data value minus the minimum
More informationEPIB Four Lecture Overview of R
EPIB-613 - Four Lecture Overview of R R is a package with enormous capacity for complex statistical analysis. We will see only a small proportion of what it can do. The R component of EPIB-613 is divided
More informationGetting Started in R
Getting Started in R Giles Hooker May 28, 2007 1 Overview R is a free alternative to Splus: a nice environment for data analysis and graphical exploration. It uses the objectoriented paradigm to implement
More informationIntroduction to R, Github and Gitlab
Introduction to R, Github and Gitlab 27/11/2018 Pierpaolo Maisano Delser mail: maisanop@tcd.ie ; pm604@cam.ac.uk Outline: Why R? What can R do? Basic commands and operations Data analysis in R Github and
More informationApplied Calculus. Lab 1: An Introduction to R
1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for
More informationsimpler Using R for Introductory Statistics
John Verzani y 2e+05 4e+05 6e+05 8e+05 20000 40000 60000 80000 120000 160000 Preface page i These notes are an introduction to using the statistical software package R for an introductory statistics course.
More informationWhat You ll Learn Today
CS101 A1 Lecture 8: Excel Decisions Making and Functions Aaron Stevens 23 September 2010 1 What You ll Learn Today Review? Using Excel formulas to perform calculations. Using decision logic to make calculations
More informationA Brief Introduction to Scheme (I)
A Brief Introduction to Scheme (I) Philip W. L. Fong pwlfong@cs.uregina.ca Department of Computer Science University of Regina Regina, Saskatchewan, Canada Scheme Scheme I p.1/44 Scheme: Feature Set A
More informationStatistics Case Study 2000 M. J. Clancy and M. C. Linn
Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed
More informationToday Function. Note: If you want to retrieve the date and time that the computer is set to, use the =NOW() function.
Today Function The today function: =TODAY() It has no arguments, and returns the date that the computer is set to. It is volatile, so if you save it and reopen the file one month later the new, updated
More informationToday Function. Note: If you want to retrieve the date and time that the computer is set to, use the =NOW() function.
Today Function The today function: =TODAY() It has no arguments, and returns the date that the computer is set to. It is volatile, so if you save it and reopen the file one month later the new, updated
More informationStatistics 133 Midterm Exam
Statistics 133 Midterm Exam March 2, 2011 When I ask for an R program, I mean one or more R commands. Try your best to make your answers general, i.e. they shouldn t depend on the specific values presented
More informationCondition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.
Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes
More informationS Basics. Statistics 135. Autumn Copyright c 2005 by Mark E. Irwin
S Basics Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin S Basics When discussing the S environment, I will, or at least try to, make the following distinctions. S will be used when what is
More informationCS164: Midterm I. Fall 2003
CS164: Midterm I Fall 2003 Please read all instructions (including these) carefully. Write your name, login, and circle the time of your section. Read each question carefully and think about what s being
More informationHandling Missing Values
Handling Missing Values STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Missing Values 2 Introduction
More informationExperiment 3 Microsoft Excel in Scientific Applications I
Experiment 3 Microsoft Excel in Scientific Applications I OUTCOMES After completing this experiment, the student should be able to: demonstrate basic computer survival skills (opening, closing, printing
More informationAssignments. Math 338 Lab 1: Introduction to R. Atoms, Vectors and Matrices
Assignments Math 338 Lab 1: Introduction to R. Generally speaking, there are three basic forms of assigning data. Case one is the single atom or a single number. Assigning a number to an object in this
More informationMAT 090 Brian Killough s Instructor Notes Strayer University
MAT 090 Brian Killough s Instructor Notes Strayer University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample
More informationProgramming R. Manuel J. A. Eugster. Chapter 4: Writing your own functions. Last modification on May 15, 2012
Manuel J. A. Eugster Programming R Chapter 4: Writing your own functions Last modification on May 15, 2012 Draft of the R programming book I always wanted to read http://mjaeugster.github.com/progr Licensed
More informationStat 4510/7510 Homework 4
Stat 45/75 1/7. Stat 45/75 Homework 4 Instructions: Please list your name and student number clearly. In order to receive credit for a problem, your solution must show sufficient details so that the grader
More informationROSE-HULMAN INSTITUTE OF TECHNOLOGY
EXAM 2 WRITTEN PORTION NAME SECTION NUMBER CAMPUS MAILBOX NUMBER EMAIL ADDRESS @rose-hulman.edu Written Portion / 48 Computer Portion / 52 Total / 100 ROSE-HULMAN INSTITUTE OF TECHNOLOGY USE MATLAB SYNTAX
More informationUse the scantron sheet to enter the answer to questions (pages 1-6)
Use the scantron sheet to enter the answer to questions 1-100 (pages 1-6) Part I. Mark A for True, B for false. (1 point each) 1. Abstraction allow us to specify an object regardless of how the object
More informationAdvanced Econometric Methods EMET3011/8014
Advanced Econometric Methods EMET3011/8014 Lecture 2 John Stachurski Semester 1, 2011 Announcements Missed first lecture? See www.johnstachurski.net/emet Weekly download of course notes First computer
More informationDSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017
DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017 There are a handful of statements (TITLE, FOOTNOTE, WHERE, BY, etc.) that can be used in a wide variety of procedures. For example,
More informationSPSS TRAINING SPSS VIEWS
SPSS TRAINING SPSS VIEWS Dataset Data file Data View o Full data set, structured same as excel (variable = column name, row = record) Variable View o Provides details for each variable (column in Data
More informationIslamic University of Gaza Faculty of Engineering Computer Engineering Department
Islamic University of Gaza Faculty of Engineering Computer Engineering Department EELE 5310: Digital Image Processing Spring 2011 Date: May 29, 2011 Time : 120 minutes Final Exam Student Name: Student
More informationCS150 - Assignment 5 Data For Everyone Due: Wednesday Oct. 16, at the beginning of class
CS10 - Assignment Data For Everyone Due: Wednesday Oct. 16, at the beginning of class http://dilbert.com/fast/2008-0-08/ For this assignment we re going to implement some initial data analysis functions
More informationName CptS 111, Spring 2018 Programming Assignment #5 Date Name of program Brief description and/or purpose of the program; include sources
CptS 111 PA #5 Due Tuesday, Mar. 20, 2018 for-loops, FIBONACCI, AND A STATISTICS PROGRAM This assignment has two parts and isn t nearly as formidable as it looks (although you shouldn t wait until the
More informationLecture 3: Basics of R Programming
Lecture 3: Basics of R Programming This lecture introduces how to do things with R beyond simple commands. We will explore programming in R. What is programming? It is the act of instructing a computer
More information1 Dynamic Programming
Recitation 13 Dynamic Programming Parallel and Sequential Data Structures and Algorithms, 15-210 (Spring 2013) April 17, 2013 1 Dynamic Programming Dynamic programming is a technique to avoid needless
More informationLecture 10. Memory in Python
Lecture 0 Memory in Python Announcements For This Lecture Reading Reread all of Chapter 3 Assignments Work on your revisions Want done by Sunday Survey: 50 responded Remaining do by tomorrow Avg Time:
More informationLecture 3: Basics of R Programming
Lecture 3: Basics of R Programming This lecture introduces you to how to do more things with R beyond simple commands. Outline: 1. R as a programming language 2. Grouping, loops and conditional execution
More informationDSCI 325: Handout 18 Introduction to Graphics in R
DSCI 325: Handout 18 Introduction to Graphics in R Spring 2016 This handout will provide an introduction to creating graphics in R. One big advantage that R has over SAS (and over several other statistical
More informationInteractive Math Glossary Terms and Definitions
Terms and Definitions Absolute Value the magnitude of a number, or the distance from 0 on a real number line Addend any number or quantity being added addend + addend = sum Additive Property of Area the
More informationMonte Carlo Integration
Lab 18 Monte Carlo Integration Lab Objective: Implement Monte Carlo integration to estimate integrals. Use Monte Carlo Integration to calculate the integral of the joint normal distribution. Some multivariable
More informationGraphics Calculator Skill Drill Series
Graphics Calculator Skill Drill Series Notes for using the Skill Drill Sheets - This worksheet series was designed with the NSW General Mathematics course in mind. The questions are randomly sequenced
More informationCIS 110 Introduction To Computer Programming. February 29, 2012 Midterm
CIS 110 Introduction To Computer Programming February 29, 2012 Midterm Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of Pennsylvania
More informationCIS 110 Introduction to Computer Programming. 17 December 2012 Final Exam
CIS 110 Introduction to Computer Programming 17 December 2012 Final Exam Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of
More informationGetting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018
Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Contents Overview 2 Generating random numbers 2 rnorm() to generate random numbers from
More informationS CHAPTER return.data S CHAPTER.Data S CHAPTER
1 S CHAPTER return.data S CHAPTER.Data MySwork S CHAPTER.Data 2 S e > return ; return + # 3 setenv S_CLEDITOR emacs 4 > 4 + 5 / 3 ## addition & divison [1] 5.666667 > (4 + 5) / 3 ## using parentheses [1]
More informationRDGL Reference Manual
RDGL Reference Manual COMS W4115 Programming Languages and Translators Professor Stephen A. Edwards Summer 2007(CVN) Navid Azimi (na2258) nazimi@microsoft.com Contents Introduction... 3 Purpose... 3 Goals...
More informationInterval Estimation. The data set belongs to the MASS package, which has to be pre-loaded into the R workspace prior to use.
Interval Estimation It is a common requirement to efficiently estimate population parameters based on simple random sample data. In the R tutorials of this section, we demonstrate how to compute the estimates.
More informationMATH 112 Section 7.2: Measuring Distribution, Center, and Spread
MATH 112 Section 7.2: Measuring Distribution, Center, and Spread Prof. Jonathan Duncan Walla Walla College Fall Quarter, 2006 Outline 1 Measures of Center The Arithmetic Mean The Geometric Mean The Median
More informationQ1: Functions / 33 Q2: Arrays / 47 Q3: Multiple choice / 20 TOTAL SCORE / 100 Q4: EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2018 Exam 2 March 30, 2018 Name: Lecture time (circle 1): 8-8:50 (Sec. 201) 12-12:50 (Sec. 202) For this exam, you may use only one 8.5 x 11 double-sided page
More information050 0 N 03 BECABCDDDBDBCDBDBCDADDBACACBCCBAACEDEDBACBECCDDCEA
050 0 N 03 BECABCDDDBDBCDBDBCDADDBACACBCCBAACEDEDBACBECCDDCEA 55555555555555555555555555555555555555555555555555 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 01 CAEADDBEDEDBABBBBCBDDDBAAAECEEDCDCDBACCACEECACCCEA
More informationModule 10: Imperative Programming, Modularization, and The Future
Module 10: Imperative Programming, Modularization, and The Future If you have not already, make sure you Read How to Design Programs Sections 18. 1 CS 115 Module 10: Imperative Programming, Modularization,
More informationLooping Subtasks. We will examine some basic algorithms that use the while and if constructs. These subtasks include
1 Programming in C Looping Subtasks We will examine some basic algorithms that use the while and if constructs. These subtasks include Reading unknown quantity of data Counting things Accumulating (summing)
More informationCOS 116 The Computational Universe Laboratory 8: Digital Logic II
COS 116 The Computational Universe Laboratory 8: Digital Logic II In this lab you ll learn that, using only AND, OR, and NOT gates, you can build a circuit that can add two numbers. If you get stuck at
More informationMath 355: Linear Algebra: Midterm 1 Colin Carroll June 25, 2011
Rice University, Summer 20 Math 355: Linear Algebra: Midterm Colin Carroll June 25, 20 I have adhered to the Rice honor code in completing this test. Signature: Name: Date: Time: Please read the following
More informationPackage cgh. R topics documented: February 19, 2015
Package cgh February 19, 2015 Version 1.0-7.1 Date 2009-11-20 Title Microarray CGH analysis using the Smith-Waterman algorithm Author Tom Price Maintainer Tom Price
More informationUNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm Sample Solutions CSC324H1 Duration: 50 minutes Instructor(s): David Liu.
UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm Sample s CSC324H1 Duration: 50 minutes Instructor(s): David Liu. No Aids Allowed Name: Student Number: Please read the following guidelines carefully.
More informationThe linear mixed model: modeling hierarchical and longitudinal data
The linear mixed model: modeling hierarchical and longitudinal data Analysis of Experimental Data AED The linear mixed model: modeling hierarchical and longitudinal data 1 of 44 Contents 1 Modeling Hierarchical
More informationCh. 3 Review. Name: Class: Date: Short Answer
Name: Class: Date: ID: A Ch. 3 Review Short Answer 1. A developer wants to subdivide a rectangular plot of land measuring 600 m by 750 m into congruent square lots. What is the side length of the largest
More informationUploading Scantron Scores to CourseWeb
From your course in, go to the Full Grade Center view. Look for a Work Offline button on the right side of the screen. Click on it, choose Download from the menu that appears and you will get a form for
More informationMath 214 Introductory Statistics Summer Class Notes Sections 3.2, : 1-21 odd 3.3: 7-13, Measures of Central Tendency
Math 14 Introductory Statistics Summer 008 6-9-08 Class Notes Sections 3, 33 3: 1-1 odd 33: 7-13, 35-39 Measures of Central Tendency odd Notation: Let N be the size of the population, n the size of the
More informationData 8 Final Review #1
Data 8 Final Review #1 Topics we ll cover: Visualizations Arrays and Table Manipulations Programming constructs (functions, for loops, conditional statements) Chance, Simulation, Sampling and Distributions
More informationAdministrativia. CS107 Introduction to Computer Science. Readings. Algorithms. Expressing algorithms
CS107 Introduction to Computer Science Lecture 2 An Introduction to Algorithms: and Conditionals Administrativia Lab access Searles 128: Mon-Friday 8-5pm (unless class in progress) and 6-10pm Sat, Sun
More informationIntroduction to MATLAB Programming
Spring 2019 Spring 2019 1 / 17 Introduction Algorithm An algorithm is a sequence of steps needed to solve a problem. We will use MATLAB to develop algorithms to solve specific problems. The basic algorithm
More informationChislehurst and Sidcup Grammar School Mathematics Department Year 9 Programme of Study
Chislehurst and Sidcup Grammar School Mathematics Department Year 9 Programme of Study Timings Topics Autumn Term - 1 st half (7 weeks - 21 lessons) 1. Algebra 1: Expressions, Formulae, Equations and Inequalities
More informationSchool of Agriculture and Natural Resources
School of Agriculture and Natural Resources Common Excel Functions for Summarizing Data Developed By Dr. Walid H. Shayya A. CONCATENATE: Joins two or more text strings (or numbers) into one text string.
More information1 Pencil and Paper stuff
Spring 2008 - Stat C141/ Bioeng C141 - Statistics for Bioinformatics Course Website: http://www.stat.berkeley.edu/users/hhuang/141c-2008.html Section Website: http://www.stat.berkeley.edu/users/mgoldman
More informationCSCI Compiler Design
CSCI 565 - Compiler Design Spring 2015 Midterm Exam March 04, 2015 at 8:00 AM in class (RTH 217) Duration: 2h 30 min. Please label all pages you turn in with your name and student number. Name: Number:
More informationDay 4 Percentiles and Box and Whisker.notebook. April 20, 2018
Day 4 Box & Whisker Plots and Percentiles In a previous lesson, we learned that the median divides a set a data into 2 equal parts. Sometimes it is necessary to divide the data into smaller more precise
More informationRepetition Structures
Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements
More informationCOS 226 Midterm Exam, Spring 2009
NAME: login ID: precept: COS 226 Midterm Exam, Spring 2009 This test is 10 questions, weighted as indicated. The exam is closed book, except that you are allowed to use a one page cheatsheet. No calculators
More informationConcepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++.
Concepts Review 1. An algorithm is a sequence of steps to solve a problem. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. 3. A flowchart is the graphical
More informationApplying Improved Random Forest Explainability (RFEX 2.0) steps on synthetic data for variable features having a unimodal distribution
Applying Improved Random Forest Explainability (RFEX 2.0) steps on synthetic data for variable features having a unimodal distribution 1. Introduction Sabiha Barlaskar, Dragutin Petkovic SFSU CS Department
More informationGrade 6 Math Vocabulary
Ratio, Rate, Unit Rate, Rate Unit Grade 6 Math Vocabulary Ratio, Rate, Unit Rate, Rate Unit Representing Equivalent Ratios Double Number Line 0 Ratio: An ordered pair of numbers which are not both zero.
More informationCS 455 Midterm Exam 1 Spring 2011 [Bono] Feb. 17, 2011
Name: USC loginid (e.g., ttrojan): CS 455 Midterm Exam 1 Spring 2011 [Bono] Feb. 17, 2011 There are 4 problems on the exam, with 50 points total available. There are 7 pages to the exam, including this
More informationPart I { Getting Started & Manipulating Data with R
Part I { Getting Started & Manipulating Data with R Gilles Lamothe February 21, 2017 Contents 1 URL for these notes and data 2 2 Origins of R 2 3 Downloading and Installing R 2 4 R Console and Editor 3
More informationComputing With R Handout 1
Computing With R Handout 1 Getting Into R To access the R language (free software), go to a computing lab that has R installed, or a computer on which you have downloaded R from one of the distribution
More informationCSE341 Spring 2017, Midterm Examination April 28, 2017
CSE341 Spring 2017, Midterm Examination April 28, 2017 Please do not turn the page until 12:30. Rules: The exam is closed-book, closed-note, etc. except for one side of one 8.5x11in piece of paper. Please
More informationSurvey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9
Survey of Math: Excel Spreadsheet Guide (for Excel 2016) Page 1 of 9 Contents 1 Introduction to Using Excel Spreadsheets 2 1.1 A Serious Note About Data Security.................................... 2 1.2
More informationGetting started with MATLAB
Getting started with MATLAB You can work through this tutorial in the computer classes over the first 2 weeks, or in your own time. The Farber and Goldfarb computer classrooms have working Matlab, but
More informationS206E Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules
S206E057 -- Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Interface of Math and Logic Functions 1. Basic mathematic operations: For example,
More informationE7 University of California, Berkeley Fall Midterm Exam 10/07/2016 version:
Name: Student ID: Midterm Exam 10/07/2016 version: 684965 UC Berkeley Honor Code: As a member of the UC Berkeley community, I act with honesty, integrity, and respect for others. On my honor, I have neither
More information9-1 GCSE Maths. GCSE Mathematics has a Foundation tier (Grades 1 5) and a Higher tier (Grades 4 9).
9-1 GCSE Maths GCSE Mathematics has a Foundation tier (Grades 1 5) and a Higher tier (Grades 4 9). In each tier, there are three exams taken at the end of Year 11. Any topic may be assessed on each of
More informationWhat is a Function? EF102 - Spring, A&S Lecture 4 Matlab Functions
What is a Function? EF102 - Spring, 2002 A&S Lecture 4 Matlab Functions What is a M-file? Matlab Building Blocks Matlab commands Built-in commands (if, for, ) Built-in functions sin, cos, max, min Matlab
More informationC++ Programming Language Lecture 2 Problem Analysis and Solution Representation
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Program Development Cycle Program development
More informationCommon R commands used in Data Analysis and Statistical Inference
Common R commands used in Data Analysis and Statistical Inference 1 One numerical variable summary(x) # most summary statitstics at once mean(x) median(x) sd(x) hist(x) boxplot(x) # horizontal = TRUE for
More informationR Programming: Worksheet 6
R Programming: Worksheet 6 Today we ll study a few useful functions we haven t come across yet: all(), any(), `%in%`, match(), pmax(), pmin(), unique() We ll also apply our knowledge to the bootstrap.
More informationObject Oriented Programming. Java-Lecture 6 - Arrays
Object Oriented Programming Java-Lecture 6 - Arrays Arrays Arrays are data structures consisting of related data items of the same type In Java arrays are objects -> they are considered reference types
More informationRSG online program documentation
RSG online program documentation The Refractive Surgery Graphics (RSG) online program lets you upload an excel file that will be processed to show you several graphics that let you have a better idea about
More informationHeteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors
Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors (Section 5.4) What? Consequences of homoskedasticity Implication for computing standard errors What do these two terms
More informationGrade 9 Surface Area and Volume
ID : ae-9-surface-area-and-volume [1] Grade 9 Surface Area and Volume For more such worksheets visit www.edugain.com Answer the questions (1) The radius of a cylinder is halved and the height is tripled.
More information