Question: The code pse _ data = np . array ( info _ df [ [ pse - same,pse - small ] ] ) grabs

The code
pse_data = np.array(info_df[["pse-same","pse-small"]])
grabs data from the Pandas dataframe to create a 2 x n numpy array that contains the PSEs for the same and small inducers condition, respectively.
(A) Please write a function subject_count that takes pse_data as input and applies the shape method to get the number of participants in your dataset and return that as an integer variable.
(B) Please write a function summary_stats that takes pse_data as input and uses the methods mean and std or their corresponding numpy commands to compute the mean and standard deviation, seperately for the two conditions, and returns them as two separate variables. Note that both mean and standard deviation can be computed in one line of code.
(C) Please write a function compute_err that takes pse_data as input and computes the standard error and 95% confidence interval, seperately for the two conditions, and returns them as two separate variables. Watch this video (also on eClass) to learn how to compute standard error using the sample size (=number of subjects), and how to convert standard error to the 95% confidence interval. You can use the command np.sqrt to take the square root of a number. Your function should return two variables named:
pse_stderr # standard error
pse_ci # 95% confidence interval
(D) Then use the following code to plot your data as a bar plot with error bars. Try replacing pse_ci with pse_stderr in the below and observe how the error bars change:
plt.bar((0,1), pse_means, yerr=pse_stderr, capsize=5)
plt.ylim([15,30])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!