The prompt for the python script is this:
Construct a 99% confidence interval for the proportion of days with solar power generation above 43 kWh for City A (cityA>43.0). In order to perform this function, you need to make the appropriate modifications to the provided script. In other words, you should:
Replace ???DATASET_NAME??? with solarkwh
Replace '???VARIABLE_NAME???' with the variable 'cityA'
Replace ???Xvalue??? with the appropriate value
The code they give us:
print ('Confidence Interval - Step 4')
n = ???DATASET_NAME???[['???VARIABLE_NAME???']].count()
x = (???DATASET_NAME???[['???VARIABLE_NAME???']] >
???Xvalue???).values.sum()
p = x/n*1.0
stderror = (p * (1 - p)/n)**0.5
print (st.norm.interval(0.99, p, stderror))
print ('')
What I have:
print ('Confidence Interval - Step 4')
n = solarkwh[['cityA']].count()
x = (solarkwh[['cityA']] > 43.0).values.sum()
p = x/n*1.0
stderror = (p * (1 - p)/n)**0.5
print (st.norm.interval(0.99, p, stderror))
print ('')
I need to know if my variables are correct based on what they are
asking me to do
I'm not sure how this is incomplete? this is literally all the info i was given.
Your code is fully correct.
print ('Confidence Interval - Step 4')
n = solarkwh[['cityA']].count()
x = (solarkwh[['cityA']] > 43.0).values.sum()
p = x/n*1.0
stderror = (p * (1 - p)/n)**0.5
print (st.norm.interval(0.99, p, stderror))
print ('')
The value of ???DATASET_NAME??? and ???VARIABLE_NAME??? is already given in the question.
We need to find the 99% confidence interval for the proportion of days with solar power generation above 43 kWh.
So, the value of ???Xvalue??? should be 43 which you have already given in the question.
Get Answers For Free
Most questions answered within 1 hours.