9.6 LAB: Generating random numbers Develop a program that would…
Question Answered step-by-step 9.6 LAB: Generating random numbers Develop a program that would… 9.6 LAB: Generating random numbers Develop a program that would generate 500 data points and create a linear regression model using the scipy.stats module.Generate a numpy array, x, of 500 numbers evenly spaced between 0 and 100.Generate another numpy array, noise, of 500 numbers from the normal distribution with a mean of 0 and standard deviation of 1.Let y be the sum of the x and noise.Code a linear regression model using x as the predictor variable and y as the response variable.If the input is:123Then the output is:LinregressResult(slope=0.9992310659831275, intercept=-0.0001972726695882443, rvalue=0.9993984742634541, pvalue=0.0, stderr=0.001553779399848215, intercept_stderr=0.08975242785858578) import numpy as npimport scipy.stats as st# set seed to inputnum = int(input())np.random.seed(num)x = # randomly generate 500 numbers between 0 and 100 using the linspace functionnoise = # randomly generate 500 numbers from the normal distribution with mean = 0 and sd = 1y = # sum of x and noisemodel = # code a linear regression model using scipy.statsprint(model) Computer Science Engineering & Technology Python Programming CIS 461 Share QuestionEmailCopy link Comments (0)


