Menu

[solved]-Need Help Python Code Please Keep Getting Error Message Wrong Please Help Milestone 1 Pyth Q39091454

I need some help with the python code please i keep getting anerror message. What i am i doing wrong please help.

stdev/ (h**0.5) #print (st.t.interval (0.95, df, mean, stderror)) #print ( ) 3. Part I: Hypothesis Testing (Scenario C) SStep 7: Perform hypothesis test for population mean It is claimed that average rice production by Company2 is 209,500 cwt (Co

####### Milestone 1 Python Script
import pandas as pd
import scipy.stats as st
from snhu_MAT243 import prop_1samp_ztest
from snhu_MAT243 import means_1samp_ttest

# ##Step 1: Import your data set
###—————————————————————————–
production = pd.read_csv(‘Rice_Production.csv’)

# ##Step 2: Calculate descriptive statistics
# ###—————————————————————————–
print (‘Descriptive Statistics – Step 2’)
print (”)

print (‘Mean’)
print (production[[‘Company1’]].mean())
print (”)

print (‘Median’)
print (production[[‘Company1’]].median())
print (”)

# print (‘Mode’)
# print (???DATASET_NAME???[[‘???VARIABLE_NAME???’]].mode())
# print (”)

print (‘Minimum’)
print (production[[‘Company1’]].min())
print (”)

print (‘Maximum’)
print (production[[‘Company1’]].max())
print (”)

print (‘Variance’)
print (production[[‘Company1’]].var())
print (”)

print (‘Standard Deviation’)
print (production[[‘Company1’]].std())
print (”)

print (‘Describe’)
print (production[[‘Company1’]].describe())
print (”)

print (”)

##Step 3: Calculate descriptive statistics
##—————————————————————————–
print (‘Descriptive Statistics – Step 3’)
print (”)

print (‘Mean’)
print (production[[‘Company2’]].mean())
print (”)

print (‘Median’)
print (production[[‘Company2’]].median())
print (”)

# print (‘Mode’)
# print (???DATASET_NAME???[[‘???VARIABLE_NAME???’]].mode())
# print (”)

print (‘Minimum’)
print (production[[‘Company2’]].min())
print (”)

print (‘Maximum’)
print (production[[‘Company2’]].max())
print (”)

print (‘Variance’)
print (production[[‘Company2’]].var())
print (”)

print (‘Standard Deviation’)
print (production[[‘Company2’]].std())
print (”)

print (‘Describe’)
print (production[[‘Company2’]].describe())
print (”)

##Step 4: Construct confidence interval for populationproportion
##—————————————————————————–
print (‘Confidence Interval – Step 4’)
n = production[[‘Company1’]].count()
x = (production[[‘Company1’]] > 307200.0).values.sum()
p = x/n*1.0
stderror = (p * (1 – p)/n)**0.5
print (st.norm.interval(0.99, p, stderror))
print (”)

# ##Step 5: Construct confidence interval for populationmean
###—————————————————————————–
print (‘Confidence Interval – Step 5’)
n = production[[‘Company2’]].count()
df = n – 1
mean = production[[‘Company2’]].mean()
stdev = production[[‘Company2’]].std()
stderror = stdev/(n**0.5)
print (st.t.interval(0.95, df, mean, stderror))
print (”)

##Step 6: Perform hypothesis test for populationproportion
##—————————————————————————–
print (‘Hypothesis Test – Step 6’)
n = production[[‘Company1’]].count()
x = (production[[‘Company1’]] > 307200.0).values.sum()
null_value = .29
alternative = ‘.05’
print (prop_1samp_ztest(x, n, null_value, alternative))
print (”)

##Step 7: Perform hypothesis test for population mean
##—————————————————————————–
print (‘Hypothesis Test – Step 7’)
n = production[[‘Company2’]].count()
df = n – 1
mean = production[[‘Company2’]].mean()
std_dev = production[[‘Company2’]].std()
null_value = 209500.0
alternative = ‘.01’
print (means_1samp_ttest(mean, std_dev, n, null_value,alternative))
print (”)

stdev/ (h**0.5) #print (st.t.interval (0.95, df, mean, stderror)) #print ( ‘ ‘ ) 3. Part I: Hypothesis Testing (Scenario C) Step 6: Perform hypothesis test ##Step 6: Perform hypothesis test for population proportion for population proportion ## – print (‘Hypothesis Test – Step 6’) n production [ [ ‘ Company1’]].count ( x = (production [ [ ‘ Company1’]] 307200.0).values.sum () null_value = 0.29 alternative= ‘0.05 print (prop 1samp_ztest (x, n, null_value, alternative) ) print () It is known that 29% of the months have rice production by Company1 above 307200 cwt (company1>307200.0). Is there sufficient evidence to suggest that the proportion is less than 29%? Test at 5% level of significance. In order to perform this function, you need to make the appropriate modifications to the provided script. In other words, ##Step 7: Perform hypothesis test for population mean # #- you should: print (‘Hypothesis Test – Step 7’ n = production [ [ ‘ Company2’]].count() df n1 mean production [ [ ‘ Company2’]].mean () std dev production [ [‘Company2 ‘].std () null_value = 209500.0 alternative 0.01′ print (means_1samp_ttest (mean, std_dev, n, null_value, alternative) ) print Comment lines 94 Comment lines 106 113 Unconment lines 119 125 Replace ???DATASET_NAME??? with production Replace ???VARIABLE_NAME???’ with the variable ‘Compar Replace ???Xvalue??? with the appropriate value 100 Replace ???NULL_VALUE??? with the appropriate value for Replace ‘???TEST_TYPE???’ with the appropriate alternat 3: 10) Python Step 7: Perform hypothesis test for population mean It is claimed that average rice production by Company2 is 209,500 cwt (Company2 209500.0). Test this claim using a hypothesis test at 1% level of significance. In order to perform this function, you need to make the appropriate modifications to the provided script. In other words, you should: Uncomment lines 131 139 Replace ???DATASET_NAME??? with production Replace ‘???VARIABLE_NAME???’ with the variable ‘Compar Replace ???NULL_VALUE??? with the appropriate value for Replace ???TEST_TYPE???’ with the appropriate alternat Part I: Hypothesis Tes… In Milestone1.py file, perform the appropriate hypothesis tests for variables Comnany1 and Company2 Show transcribed image text stdev/ (h**0.5) #print (st.t.interval (0.95, df, mean, stderror)) #print ( ‘ ‘ ) 3. Part I: Hypothesis Testing (Scenario C) Step 6: Perform hypothesis test ##Step 6: Perform hypothesis test for population proportion for population proportion ## – print (‘Hypothesis Test – Step 6’) n production [ [ ‘ Company1’]].count ( x = (production [ [ ‘ Company1’]] 307200.0).values.sum () null_value = 0.29 alternative= ‘0.05 print (prop 1samp_ztest (x, n, null_value, alternative) ) print () It is known that 29% of the months have rice production by Company1 above 307200 cwt (company1>307200.0). Is there sufficient evidence to suggest that the proportion is less than 29%? Test at 5% level of significance. In order to perform this function, you need to make the appropriate modifications to the provided script. In other words, ##Step 7: Perform hypothesis test for population mean # #- you should: print (‘Hypothesis Test – Step 7’ n = production [ [ ‘ Company2’]].count() df n1 mean production [ [ ‘ Company2’]].mean () std dev production [ [‘Company2 ‘].std () null_value = 209500.0 alternative 0.01′ print (means_1samp_ttest (mean, std_dev, n, null_value, alternative) ) print Comment lines 94 Comment lines 106 113 Unconment lines 119 125 Replace ???DATASET_NAME??? with production Replace ???VARIABLE_NAME???’ with the variable ‘Compar Replace ???Xvalue??? with the appropriate value 100 Replace ???NULL_VALUE??? with the appropriate value for Replace ‘???TEST_TYPE???’ with the appropriate alternat 3: 10) Python
Step 7: Perform hypothesis test for population mean It is claimed that average rice production by Company2 is 209,500 cwt (Company2 209500.0). Test this claim using a hypothesis test at 1% level of significance. In order to perform this function, you need to make the appropriate modifications to the provided script. In other words, you should: Uncomment lines 131 139 Replace ???DATASET_NAME??? with production Replace ‘???VARIABLE_NAME???’ with the variable ‘Compar Replace ???NULL_VALUE??? with the appropriate value for Replace ???TEST_TYPE???’ with the appropriate alternat Part I: Hypothesis Tes… In Milestone1.py file, perform the appropriate hypothesis tests for variables Comnany1 and Company2

Expert Answer


Answer to I need some help with the python code please i keep getting an error message. What i am i doing wrong please help. #####… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *