75 views

Uploaded by dsdsdsdasd

asd

asd

Attribution Non-Commercial (BY-NC)

- Explicatie Raven Teste
- Week7 Homework
- Statistics 1 AQA Revision Notes
- Meteorological Calculations
- Tutorial_2.pdf
- T3Gr5CycleTest q
- Nelson MHF 4U Advanced Function 1.1
- 345723682 JCI Accreditation Standards 6th Edition PDF
- Graphics Programming Guide
- 2008 foltete berthier cosson ECOLOGICAL MODELLING.pdf
- Insight 2015 Mathematical Methods Examination 2 Solutions
- Jurnal Forensik Ilham
- INFLUENCES OF SOCIAL ADJUSTMENT AS PREDICTORS OF MORAL VALUES AND ACADEMIC ACHIEVEMENT
- semester 2 final exam study guide 2 answer key
- Week 1 DLP.xlsx
- EEG206_Exams_2011-2012_Part-B
- EM2011Prelim
- 12035
- Shifting a Graph AVF
- Organizational Conflicts Causes, Effects and Remedies

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.

- Explicatie Raven TesteUploaded bylutetu
- Week7 HomeworkUploaded byyashar2500
- Statistics 1 AQA Revision NotesUploaded byShiv Kumar Singh
- Meteorological CalculationsUploaded bycagnash
- Tutorial_2.pdfUploaded byminhthang_hanu
- T3Gr5CycleTest qUploaded byerinconrad
- Nelson MHF 4U Advanced Function 1.1Uploaded by胡晓格
- 345723682 JCI Accreditation Standards 6th Edition PDFUploaded bySanjeev Chougule
- Graphics Programming GuideUploaded byali
- 2008 foltete berthier cosson ECOLOGICAL MODELLING.pdfUploaded byValentina Reyes Feris
- Insight 2015 Mathematical Methods Examination 2 SolutionsUploaded bynochnoch
- Jurnal Forensik IlhamUploaded byIlham Taufan
- INFLUENCES OF SOCIAL ADJUSTMENT AS PREDICTORS OF MORAL VALUES AND ACADEMIC ACHIEVEMENTUploaded byAlex American-ajiras Brond
- semester 2 final exam study guide 2 answer keyUploaded byapi-344176657
- Week 1 DLP.xlsxUploaded byDindin Oromedlav Lorica
- EEG206_Exams_2011-2012_Part-BUploaded byMayowa
- EM2011PrelimUploaded bySereneChua
- 12035Uploaded byMujahid Raza Noori
- Shifting a Graph AVFUploaded bysound05
- Organizational Conflicts Causes, Effects and RemediesUploaded bykapil
- Lesson A10: Graphs: Functions (Đồ thị một số hàm số)Uploaded byapi-19473489
- transforming functionUploaded byapi-287584139
- Assignment1_EG168MATLAB(1)Uploaded bymoose187
- isthereadifferenceportfolio-hampaeiUploaded byapi-271347946
- s s-7 relation versus functionUploaded byapi-253679034
- Math173rdExam.pdfUploaded byAndrea Franchesca Descalzo
- Process Capability and Six Sigma MethodologyUploaded byHanaa Adel
- CurriculumUploaded byKenji Fujima
- Stat CheatUploaded byAlex Montas
- group 24 business analytics.docxUploaded byAbhishek Sharma

- ONTAP Select Performance Characterization ToolUploaded byLuis Fontalban
- Stephen Hawking BiographyUploaded byAshwin KV
- Self Quiz From CD Chap 17Uploaded byKarthik Chanakya
- Thomas Russian i wUploaded byTaira Kuusk
- ISO IEC 27002 Baseline SelectionUploaded byLutfi Swessi
- Peace Corps Medical SecretaryUploaded byAccessible Journal Media: Peace Corps Documents
- solution manual of cnc technologyUploaded byAnush Swaminathan
- Arena Wp BomUploaded byKaori Ibarra
- UA06 9370 Product Specification INTERNAL May08Uploaded bymansour14
- OpenERP Technical Memento v0.6.3Uploaded byazizibilel
- PythonScientificUploaded byLuis Carvalheiro
- 1-1501Uploaded byAnand Ramamurthy
- Philips HTS3154Uploaded bymikakimishu
- Management MarketingUploaded bygretchen muzones
- Power BI Session 1Uploaded bydanthuri
- Educational System in PakistanUploaded bym13329
- Rf Stability Manual EnUploaded bycristinelb
- solar energy lesson planUploaded byapi-270356197
- NP_V UnitUploaded bySarath Chandra Prasad
- Information Seeking BehavioursUploaded byEmi Triastuty
- SPAGS_ApplicationForm - Thesis & Research Paper UPDATEDUploaded bysoss2011
- A Case Study On Network Virtualization - Assis NgoloUploaded byAssis Madeira Ngolo
- fir filter verilog fpgaUploaded bytkbattula
- Vehicle Ramming Guidance 5-4-17Uploaded byTucson News Now
- OpenERP Technical Memento v0.6Uploaded byEneko Diaz De Lezana
- KonaKart User GuideUploaded bydoinny
- Rescind DMV ContractUploaded byNoah Body
- datasheet lm 317Uploaded bydob.lank
- Course 6231B Microsoft SQL ServerUploaded bycmoscu
- tmp6184.tmpUploaded byFrontiers