75 views

Uploaded by dsdsdsdasd

asd

- Area Under or Enclosed by the Curve
- Calculator Instructions - Casio.pdf
- Latih Tubi JPN 2008 Paper 1 Set 2A
- Corporate Finance_FM10_7 and 8
- STUDY OF PUNCTUALITY AMONG SCHOOL GOING ADOLESCENTS IN RELATION TO THEIR HOME ENVIRONMENT
- unpacking standard
- Test Interpretation
- Questions on Function
- Chapter_5_QS015_2017_18_Nota_Pelajar_1_
- Phi2-02
- Chp4_Soln_r3
- g8m5l3- linear functions and proportionality
- 07ch
- CUSUM (Old Format)
- qp
- Tutorial Excel Variance Sample
- Assignment 1 - IsA
- Holland’s Method as a Material in Environmental Education
- 1 Functions
- lesson plan day 1

You are on page 1of 3

October 4, 2013

1. Pearsons Coefcient is widely used in the natural sciences as a measure of correlation between two variables. Given two lists, X = ( x 1 x 2 . . . x n ) and Y = ( y1 y2 . . . yn ), each containing n values, Pearsons Coefcient is dened by the expression: n i =1 ( x i X )( yi Y ) , n n )2 )2 ( x X ( y Y i i i =1 i =1 and Y denote the averages of the x i and the yi , which is to say that where X = X 1 n xi

i

and

= Y

1 n

yi .

i

(a) Write a function that takes a list and returns its sum. . (Note: You will have (b) Write a function that takes a list X = ( x 1 x 2 . . . x n ) and returns the average X to compute the length of the list in order to compute the average.) (c) Write a function that maps a list X to the square of its deviation. Thus the list X = ( x 1 x 2 . . . x n ) should be carried to the list )2 . . . ( x n X )2 ) . (( x 1 X You should use the map function. (For example, your function, when evaluated on the list (1 2 3 4 5), should return (4 1 0 1 4).) (d) Write a function that returns the standard deviation of a list, easy, you already have the functions you need. (1/n)

n i =1 ( x i

)2 . This should be X

(e) Write a new version (called map2) of the map function which operates on two lists. Your function should accept three parameters, a function f and two lists X and Y , and return a new list composed of the function f applied to corresponding elements of X and Y . In particular, given two lists ( x 1 x 2 . . . x n ) and ( y1 y2 . . . yn ) (and the function f ), map2 should return ( f ( x 1 , y1 ) . . . f ( x n , yn )) . (f) Write a function that, given two lists X = ( x 1 x 2 . . . x n ) and Y = ( y1 y2 . . . yn ), computes the covariance list: )( y1 Y ) . . . (X n X )(Yn Y )) . (( x 1 X (g) Write a function that computes Pearsons Coefcient. It might be useful to observe that an equivalent way to write Pearsons coefcient, by dividing the top and bottom by n, is

1/n

n i =1 ( x i

)( yi Y ) X

(X )(Y )

2. Least-Squares Line Fitting. Line tting refers to the process of nding the best tting line for a set of points. This is one of the most fundamental tools that natural scientists use to t mathematical models to experimental data. As an example, consider the red points in the scatter plot of Figure 1. They do not lie on a line, but there is a line that ts them very well, shown in black. This line has been chosenamong all possible linesto be the one that minimizes the sum of squares of the vertical distances from the points to the line. (This may

140 120 100 80 60 40 20 160 180 200 220 240 260 280

Figure 1: An example of a scatter plot and a best-t line. seem like an odd thing to minimize, but it turns out that there are several reasons that it is the right thing minimize.) Since the equation of a line is y = a + bx , this boils down to nding a slope b and x-intercept a for given lists X and Y corresponding to point data. It turns out that the best tting line can be found with the following two equations: ( Y ) bX , b=r , and a = Y ( X ) where (X ) and (Y ) refer to the standard deviations of X and Y and r is Pearsons Coefcient. (a) Write a function that takes two lists X and Y (of the same length) and returns a pair (a, b) corresponding to the best t line for the data. (b) Find the best t line for the following data: X = {160, 180, 200, 220, 240, 260, 280} , Y = {126, 103, 82, 75, 78, 40, 20} .

Write a new function (line x) which is the equation of the best t line. (c) We would like to plot the original data along with the best t line. To do this we will need to zip lists X and Y into a list of data points. You wrote zip in last weeks homework. Rewrite this function as zip2 and make use of map2 function (the implementation should be much simpler). The plotting package requires a list of vectors rather than pairs. Vectors havent been covered in class, but it will sufce to replace the cons keyword with vector in your implementation of zip2. Now plot the best t line and data using the following command: ( p l o t ( l i s t ( axes ) ( f u n c t i o n l i n e 140 300) ( points ( zip2 X Y ) ) ) ) 3. Dene a SCHEME function, merge, which takes two lists 1 and 2 as arguments. Assuming that each of 1 and 2 are sorted lists of integers (in increasing order, say), merge must return the sorted list containing all elements of 1 and 2 . To carry out the merge, observe that since 1 and 2 are already sorted, it is easy to nd the smallest element among all those in 1 and 2 : it is simply the smaller of the rst elements of 1 and 2 . Removing this smallest 2

element from whichever of the two lists it came from, we can recurse on the resulting two lists (which are still sorted), and place this smallest element at the beginning of the result.

- Area Under or Enclosed by the CurveUploaded byjeffconnors
- Calculator Instructions - Casio.pdfUploaded byFredyRubenRicaldiRios
- Latih Tubi JPN 2008 Paper 1 Set 2AUploaded bycjleeas
- Corporate Finance_FM10_7 and 8Uploaded bySushama Patil
- STUDY OF PUNCTUALITY AMONG SCHOOL GOING ADOLESCENTS IN RELATION TO THEIR HOME ENVIRONMENTUploaded byAnonymous CwJeBCAXp
- unpacking standardUploaded byapi-352927285
- Test InterpretationUploaded byRosanna Jose Cuevas
- Questions on FunctionUploaded byAryan Srivastava
- Chapter_5_QS015_2017_18_Nota_Pelajar_1_Uploaded byAhmad Mutqma
- Phi2-02Uploaded byjosefranciscoparis
- Chp4_Soln_r3Uploaded bysyuhunniepie
- g8m5l3- linear functions and proportionalityUploaded byapi-276774049
- 07chUploaded byKhaireCr
- CUSUM (Old Format)Uploaded byvolmink
- qpUploaded byAR Ananth Rohith Bhat
- Tutorial Excel Variance SampleUploaded byMar Cris Velasco
- Assignment 1 - IsAUploaded bySanjib Biswas
- Holland’s Method as a Material in Environmental EducationUploaded byAnonymous kqqWjuCG9
- 1 FunctionsUploaded byyen 1978
- lesson plan day 1Uploaded byapi-316605316
- 2005 AliUploaded byalfavector
- 048 Pat LimitsUploaded bytorrespac
- child_labor_MridulUploaded byHimanshu Mishra
- Why Square the Difference Instead of Taking the Absolute Value in Standard DeviationUploaded byIsrael Anido
- Six Sigma QualityUploaded byJosé Emilio Román de Anda
- CORRELATIONAL STUDYUploaded byMClarissaE
- concept description and reflection 2Uploaded byapi-374416389
- Biology Lab ReportUploaded byrashmi_harry
- msa ace inv 1Uploaded byapi-413796204
- Education for Rural People - A Neglected Key to Food SecurityUploaded byDanJanning

- EngUploaded byangga
- True Rp Project Charter 113458Uploaded byleoaug
- Central Venous Pressure MonitoringUploaded bypauchanmnl
- m604_605_606_tmUploaded byMatloob Khan
- ADAM-4018Uploaded byanggoro_gasn
- Company Profile - CTEUploaded bymishraavneesh
- Japanoise Review Current MusicologyUploaded byden127755
- Stop The IndecisionUploaded byFarhan Hayat
- Civil Engineering Industrial Training Report (Piling and Road)Uploaded byBshfirnaudz
- Chap3 Developing Aims & ObjectivesUploaded byIceChoco
- Consumer CatalogueUploaded byjamehta1
- Phy 331 Advanced elsctrodynamics.pdfUploaded byapaloseco
- NT41893F697BC1D57443BB76AFC7AB56272EB.PDFUploaded bykhattar31
- Flexibke Pedagogies_technology-enhanced learning_Neil Gordon.pdfUploaded byVíctor Montiel
- roaring 20s rubricUploaded byapi-109780801
- Answers of an Alien From Andromeda GalaxyUploaded bywtemple
- Princeton_1216.pdfUploaded byelauwit
- Chapter 3 -Calculations With Chemical Formulas (1)Uploaded byRashid Emoroni
- National Building Code Recommended NY 1913Uploaded byRoberto Catalani
- LAX VOX HandoutsUploaded byChris
- Semi Solid ADC12Uploaded byAn Zisck
- Solaris 11 Administration GuideUploaded bygopal4u
- The Role of Deliberate PracticeUploaded byKATHY
- REVIEW OF THERMAL ENERGY STORAGE SYSTEMS AND THEIR APPLICATIONSUploaded byIJIERT-International Journal of Innovations in Engineering Research and Technology
- Blastomycosis_ Fungal Infections_ Merck Veterinary ManualUploaded byArifin Saiful
- Writing reflectionUploaded byAmy Nova
- Seismic Assessment of Existing Bridge Using OPENSEESUploaded byIJMER
- Lecture 4 - Spread Spectrum TechnologiesUploaded byરામ પ્રતાપ
- Dark Universe Matter Energy and Gravity 2004 en 204sUploaded byChris Dupuis
- Customer Relationship Management in the Automotive Industry Solution BriefUploaded bytinusebastian