Reputation: 33
I am new to Python and i wanted to programm a confidence intervall. This is the code i used:
conf= st.t.interval(alpha=0.95, df=len(df)-1, loc=np.mean(df_efw).mean(), scale=st.sem(df.stack()))
There is actually no problem with the code, it works. However, i found it somewhere but i simply dont understand it. I am using 95% confidence interval, therefore my alpha is 5%. Why do i have to write alpha = 0.95
?. And why do i have to write -1
in the len(df)
. What i also dont understand is the loc
and scale
.
Upvotes: 0
Views: 1250
Reputation: 48
I bet the first df
in df=len(df)-1
stands for degrees of freedom rather than dataframe. Degrees of freedom is n (the number of observations) - 1 in almost all cases, so that tracks.
I'd recommend going directly to the source and searching the scipy documentation if that's what you're using.
Upvotes: 1