Quiz 14 - FDA

.pdf

School

Stony Brook University *

*We aren’t endorsed by this school

Course

572

Subject

Industrial Engineering

Date

Dec 6, 2023

Type

pdf

Pages

8

Uploaded by GrandIce91895

Report
11/2/23, 4:01 PM Quiz 14 localhost:8889/nbconvert/html/Downloads/Quiz 14.ipynb?download=false 1/8 <class 'pandas.core.frame.DataFrame'> RangeIndex: 1000 entries, 0 to 999 Data columns (total 1 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Number of Tests 1000 non-null int64 dtypes: int64(1) memory usage: 7.9 KB In [1]: # Importing necessary libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt # Generating the dataset np . random . seed ( 42 ) r = 3 # Number of failures p = 0.2 # Probability of failure data = np . random . negative_binomial ( r , p , 1000 ) # Generating data using negative binomial distribution df = pd . DataFrame ( data , columns = [ 'Number of Tests' ]) # Display the first few rows of the dataframe df . head () Out[1]: In [2]: df . info () In [3]: df . describe ()
11/2/23, 4:01 PM Quiz 14 localhost:8889/nbconvert/html/Downloads/Quiz 14.ipynb?download=false 2/8 Out[3]: In [4]: # Plotting the histogram plt . figure ( figsize = ( 10 , 6 )) plt . hist ( df [ 'Number of Tests' ], bins = 20 , color = 'skyblue' , edgecolor = 'black' ) plt . title ( 'Distribution of Number of Tests Before Failure' , fontsize = 15 ) plt . xlabel ( 'Number of Tests' , fontsize = 12 ) plt . ylabel ( 'Frequency' , fontsize = 12 ) plt . grid ( axis = 'y' , alpha = 0.75 ) plt . show ()
11/2/23, 4:01 PM Quiz 14 localhost:8889/nbconvert/html/Downloads/Quiz 14.ipynb?download=false 3/8 In [5]: mean_data = np . mean ( data ) var_data = np . var ( data ) In [6]: p_estimated = mean_data / var_data
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help