You are interested in analyzing the housing market in a given city and you have data...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are interested in analyzing the housing market in a given city and you have data on all houses that have recently sold as well as their size (in square feet). In particular, you are interested in determining a valuation of a candidate house based solely on this historic data (sales price and square footage). First, you would like to remove any outliers from the historic data set. A historic sale is classified as an outlier using the following procedure: • Select the home to test from the historic data set • Create a list of prices of other homes of the exact same size. It will be called comparison List in the examples. • If there are zero houses of the same size, the house being tested is not an outlier. . Otherwise: • Calculate the average price, H. and the standard deviation, a, for the homes in the comparisonList. If | price[i]-μ| >3*a, then the house is an outlier. Once the outliers have been removed, then the valuation of the candidate house can be calculated as follows: • If there are no houses remaining in the historic list, use 1000 as the price. • If there is only 1 house in the list, its price is used. • If there are 1 or more houses in the list with the exact square footage of the house to price, use the average of those prices. • If the required square footage is between the square footage of two houses in the list, linearly interpolate the square foot price using the means of the closest higher and lower-priced homes. • If the required square footage is outside of the range of houses listed, linearly extrapolate the price based on the means of the two square footage values that are closest to the home to value. in all cases, if the final price is less than 103 or greater than 106, the price will be 103 and 106, respectively. In all cases, the returned value should be rounded to the nearest whole integer. To interpolate or extrapolate a point (x, y) when x is known from the points (X₁.₁) and (x2.₂) the following formula can be used: y = y₁ + (x-x₁)*(V2-Y1)/(x2-x1) For example, there are n = 6 houses with area = [1200, 1300, 1200, 1300, 1200, 2000), price=[12000, 24000, 14000, 22000, 13000, 30000] and the house to value has reqArea = 1500 square feet. The following table shows the test for outliers: To Test area/price 1200/12000 1300/24000 1200/14000 1300/22000 1200/13000 2000/30000 compList [14000, 13000] [22000] [12000, 13000] [24000] [12000, 14000] Constraints 0 ● ● P[m] ● 13500 22000 12500 500 ≤ reqArea 105 24000 13000 NIL O 500 0 500 500 ≤ area[i] ≤ 105 for all i such that 0≤i<n 103 ≤ price[i] ≤ 106 for all i such that 0 ≤i<n 1≤n≤105 0 1000 N/A | price - P[m]| 1500 2000 1500 2000 1000 3*0 * There is only one house with this area, so it cannot be an outlier. 1500 0 1500 int reqArea: the area of the candidate house in square feet int area[n]: area[i] is the area in square feet of the ith house sold from the historic data set int price[n]: price[i] is the price of the ith house sold from the historic data set 0 3000 Is outlier? The 1300 square foot houses are both outliers, so they are discarded. The new arrays are area' = [1200, 1200, 1200, 2000] and price' = [12000, 14000, 13000, 30000]. Interpolate the price between the two house sizes remaining. The interpolated price is 13000 + (1500-1200)*(30000 - 13000)/(2000-1200) = 19375. False Function Description Complete the function findValuation in the editor below. The function must return the expected price rounded to the nearest integer. findValuation has the following parameter(s): True False True False False* ► Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing STDIN 1200 5 1500 500 1000 2000 2500 5 30000 10000 20000 40000 50000 Function 24000 → reqArea = 1200 area [] size n = 5 → area = [1500, 500, 1000, 2000, 2500] → price[] size n = 5 → price = [30000, 10000, 20000, 40000, 50000] Sample Output Explanation 1000 and 1500 are the closest smaller and larger areas for 1200. The candidate house value is 20000 + (1200-1000) * (30000- 20000)/(1500-1000). ► Sample Case 1 Language Python 3 Environment Autocomplete Ready 1> #!/bin/python3.** 10 # 11 12 13 # The function is expected to return a LONG_INTEGER. 14 # The function accepts following parameters: 15 # 1. LONG INTEGER reqArea 16 # 2. LONG INTEGER_ARRAY area 17 # 3. LONG INTEGER_ARRAY price 18 # 19 20 21 22 > if # Complete the findValuation' function below. # def findValuation (reqArea, area, price): #write code here name__ == '__main__':-. O G ... You are interested in analyzing the housing market in a given city and you have data on all houses that have recently sold as well as their size (in square feet). In particular, you are interested in determining a valuation of a candidate house based solely on this historic data (sales price and square footage). First, you would like to remove any outliers from the historic data set. A historic sale is classified as an outlier using the following procedure: • Select the home to test from the historic data set • Create a list of prices of other homes of the exact same size. It will be called comparison List in the examples. • If there are zero houses of the same size, the house being tested is not an outlier. . Otherwise: • Calculate the average price, H. and the standard deviation, a, for the homes in the comparisonList. If | price[i]-μ| >3*a, then the house is an outlier. Once the outliers have been removed, then the valuation of the candidate house can be calculated as follows: • If there are no houses remaining in the historic list, use 1000 as the price. • If there is only 1 house in the list, its price is used. • If there are 1 or more houses in the list with the exact square footage of the house to price, use the average of those prices. • If the required square footage is between the square footage of two houses in the list, linearly interpolate the square foot price using the means of the closest higher and lower-priced homes. • If the required square footage is outside of the range of houses listed, linearly extrapolate the price based on the means of the two square footage values that are closest to the home to value. in all cases, if the final price is less than 103 or greater than 106, the price will be 103 and 106, respectively. In all cases, the returned value should be rounded to the nearest whole integer. To interpolate or extrapolate a point (x, y) when x is known from the points (X₁.₁) and (x2.₂) the following formula can be used: y = y₁ + (x-x₁)*(V2-Y1)/(x2-x1) For example, there are n = 6 houses with area = [1200, 1300, 1200, 1300, 1200, 2000), price=[12000, 24000, 14000, 22000, 13000, 30000] and the house to value has reqArea = 1500 square feet. The following table shows the test for outliers: To Test area/price 1200/12000 1300/24000 1200/14000 1300/22000 1200/13000 2000/30000 compList [14000, 13000] [22000] [12000, 13000] [24000] [12000, 14000] Constraints 0 ● ● P[m] ● 13500 22000 12500 500 ≤ reqArea 105 24000 13000 NIL O 500 0 500 500 ≤ area[i] ≤ 105 for all i such that 0≤i<n 103 ≤ price[i] ≤ 106 for all i such that 0 ≤i<n 1≤n≤105 0 1000 N/A | price - P[m]| 1500 2000 1500 2000 1000 3*0 * There is only one house with this area, so it cannot be an outlier. 1500 0 1500 int reqArea: the area of the candidate house in square feet int area[n]: area[i] is the area in square feet of the ith house sold from the historic data set int price[n]: price[i] is the price of the ith house sold from the historic data set 0 3000 Is outlier? The 1300 square foot houses are both outliers, so they are discarded. The new arrays are area' = [1200, 1200, 1200, 2000] and price' = [12000, 14000, 13000, 30000]. Interpolate the price between the two house sizes remaining. The interpolated price is 13000 + (1500-1200)*(30000 - 13000)/(2000-1200) = 19375. False Function Description Complete the function findValuation in the editor below. The function must return the expected price rounded to the nearest integer. findValuation has the following parameter(s): True False True False False* ► Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing STDIN 1200 5 1500 500 1000 2000 2500 5 30000 10000 20000 40000 50000 Function 24000 → reqArea = 1200 area [] size n = 5 → area = [1500, 500, 1000, 2000, 2500] → price[] size n = 5 → price = [30000, 10000, 20000, 40000, 50000] Sample Output Explanation 1000 and 1500 are the closest smaller and larger areas for 1200. The candidate house value is 20000 + (1200-1000) * (30000- 20000)/(1500-1000). ► Sample Case 1 Language Python 3 Environment Autocomplete Ready 1> #!/bin/python3.** 10 # 11 12 13 # The function is expected to return a LONG_INTEGER. 14 # The function accepts following parameters: 15 # 1. LONG INTEGER reqArea 16 # 2. LONG INTEGER_ARRAY area 17 # 3. LONG INTEGER_ARRAY price 18 # 19 20 21 22 > if # Complete the findValuation' function below. # def findValuation (reqArea, area, price): #write code here name__ == '__main__':-. O G ...
Expert Answer:
Answer rating: 100% (QA)
To implement the findValuation function according to the provided description you can follow these steps in Python Create a function findValuation that takes three parameters reqArea area and price Fi... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
You are a junior accountant of Titanic Bike Parts Limited (TBL) which purchases and resells bike parts to other bike manufacturers. TBL started operations on January 1, 2020. You have been tasked in...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
If you wanted to double $1,000 in 10 years' time, what average rate of return would you require on your investment?
-
Saturated water vapor at 200 kPa is in a constant pressure piston cylinder. At this state the piston is 0.1 m from the cylinder bottom. How much is this distance and the temperature if the water is...
-
Dean's Sales Ltd., a small Ford dealership, has provided you with the following information with respect to its vehicle inventory for the month of April. The company uses the specific identification...
-
Blatt Consulting Services is interested in comparing the number of customer accounts managed by its consultants. The chart below is a default chart produced in Excel. a. Which preattentive attributes...
-
Heathrow issues $2,000,000 of 6%, 15-year bonds dated January 1, 2011, that pay interest semiannually on June 30 and December 31. The bonds are issued at a price of $1,728,224. Required 1. Prepare...
-
The measured values for the experiment with the Francis Turbine are as in the table. Calculate the hydraulic efficiency of the pump according to the given values. Francis N T Q H P g m Trbini (pompa)...
-
The management of the WBC television network has been celebrating for days. What a coup! After several unsuccessful attempts in recent decades, they finally have hit the big jackpot. They have won...
-
What effect do you feel the change in the UCR definition of rape and recent high publicity cases regarding sexual assault and harassment (such as The Me-Too movement) will have on sexual assault...
-
Choose... Scenario Analysis Payback Period Forecasting Risk/Estimating Risk Security Market Line (SML) Capital Gains Yield Risk Equation Project Net Working Capital Breakeven Internal Rate of Return...
-
Discuss how environment affects behavior
-
Once upon a time a farmer went to market and purchased a fox, a goose, and a bag of beans. On his way home, the farmer came to the bank of a river and rented a boat. But in crossing the river by...
-
Luke purchased a 180-day $500, 000 bank bill on 1 January 2019 at a yield rate of 3.18% p.a. (simple interest rate). He sold this bank bill on 15 April 2019 at a yield rate of 3.06% p.a. (simple...
-
On January 2 , 2 0 2 4 , the Jackson Company purchased equipment to be used in its manufacturing process. The equipment has an estimated life of eight years and an estimated residual value of $ 5 6 ,...
-
Question: Find even component of given signal. H() -2t e cost
-
The Cholesterol Level data sets give cholesterol levels of heart attack patients. Cholesterol measures are taken 2, 4, and 14 days aft er a patient has suffered a heart attack. Is there a significant...
-
Cooper Company (CC), a public company based in Western Canada, recently acquired the leasehold interests in 220 sites and the website of Messer Corporation (MC), a company operating a chain of...
-
Explain whether the NCI is better classied as debt or equity.
-
Gunz Inc. is a medium-sized company involved in the manufacture of paints in northern Ontario. It has been owned since inception by the Gunz family. However, the younger Gunz family members are...
-
Describe how framing heuristics affect a managers escalation of commitment.
-
You have 100 doses of a vaccine against a deadly strain of influenza that is sweeping the country, with no prospect of obtaining more. Standing in line are 100 schoolchildren and 100 elderly people....
-
Discuss what is meant by the term stress management and available interventions for organizations and individuals.
Study smarter with the SolutionInn App