Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added temporaly change #74

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions statistics/src/draw_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,23 @@ def draw_graph(self, data, title, xlabel, ylabel, tight_layout=False, mode="pair
max_y_data: max y value for scale
"""
y_data = []
tmp=0
for i in range(len(data.keys())):
y_data.append(np.mean(data[(data.keys())[i]]))
max_y_data = math.ceil(max(y_data))
tmp=0
for j in range(len(data[(data.keys())[i]])):
print "test: "
print data[(data.keys())[i]][j]
#print data[((data.keys())[i])[j]]
if data[(data.keys())[i]][j] == 1:
tmp += 1
print tmp
y_data.append(tmp)
#y_data.append(np.mean(data[(data.keys())[i]]))
tmp_list = []
for i in range(len(data.keys())):
tmp_list.append(len((data.keys())[i]))
#max_y_data = math.ceil(max(len(data.keys())))
max_y_data = math.ceil(max(tmp_list))
"""
y_error: calculate sample_error as list [err_0, err_1]
left: list of x value for each bar, now it is just empty
Expand All @@ -46,7 +60,10 @@ def draw_graph(self, data, title, xlabel, ylabel, tight_layout=False, mode="pair
"""
y_error = []
for i in range(len(data.keys())):
y_error.append(np.std(data[(data.keys())[i]], ddof=False))
#y_error.append(np.std(data[(data.keys())[i]], ddof=False))
y_error.append((len((data.keys())[i]) * np.std(data[(data.keys())[i]], ddof=False)))
print "y_error: "
print y_error
left = np.array([])
"""
left: list of x value (the number of order) for each bar
Expand Down Expand Up @@ -106,7 +123,9 @@ def draw_graph(self, data, title, xlabel, ylabel, tight_layout=False, mode="pair
add p value and mark
"""
if p < 0.05:
input_word = "**" + " (p = " + str(round (p * 1000.0) * 0.001) + " )"
#input_word = "**" + " (p = " + str(round (p * 1000.0) * 0.001) + " )"
print p
input_word = "**" + " (p = " + str(round (p * 100000.0) * 0.00001) + " )"
plt.text(1.3, max_y_data * 0.75, input_word)
elif p < 0.1:
input_word = "*" + " (p = " + str(round (p * 1000.0) * 0.001) + " )"
Expand Down
17 changes: 13 additions & 4 deletions statistics/src/sample_t_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
d.draw_graph(data, "test", "x", "y", tight_layout=True, mode="unpaired-ttest")

elif args[1] == "paired-ttest":
# followed this website for sample: http://kogolab.chillout.jp/elearn/hamburger/chap5/sec1.html
data = {'HamburgerA': [90, 75, 75, 75, 80, 65, 75, 80],
'HamburgerB' : [95, 80, 80, 80, 75, 75, 80, 85]}
d.draw_graph(data, "test", "x", "y", tight_layout=True)
# # followed this website for sample: http://kogolab.chillout.jp/elearn/hamburger/chap5/sec1.html
# data = {'HamburgerA': [90, 75, 75, 75, 80, 65, 75, 80],
# 'HamburgerB' : [95, 80, 80, 80, 75, 75, 80, 85]}

# # children
data = {'Talking to the robot': [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1],
'Touching the robot': [0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1]}
d.draw_graph(data, "The number of children \nwho spontaneously interacted with the robot", "Action Type", "Number", tight_layout=True)

# adult
# data = {'Talking to the robot': [1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0],
# 'Touching the robot': [0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0]}
# d.draw_graph(data, "The number of adults \nwho spontaneously interacted with the robot", "Action Type", "Number", tight_layout=True)