Python Forum
Estimating standard deviation from DataSet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Estimating standard deviation from DataSet
#1
Question 
SO I am having a hard time trying to calculate the standard deviation given the graph. I was wondering what the steps were? Here is a code of what I have so far, but is not getting the right output. the DataSet contains thousands of random numbers such as:
9.8254457980e-1 1.0293906530e+0 8.6314178340e-1 8.7754757930e-1 8.2216021950e-1 9.8155318390e-1 1.0215753050e+0 1.0064994180e+0 1.0300426240e+0 8.7195144970e-1 9.4140464140e-1 1.0811751280e+0 8.5982980390e-1
İmage


#Worksheet 1.3A - make plot of DataSet vs row Nums
from numpy import *
from matplotlib.pyplot import *
import matplotlib.pyplot as plt

--------------------------------------------------------------

# Import data as a list of numbers
with open("DataSet1.dat", "r") as textFile:
data = textFile.read().split() # split based on spaces
data = [float(point) for point in data] # convert strings to floats
rms = 0
#This is my code for calculating the square of the deviation
sqrt_rms = square(rms)
variance = average([square(i) for i in textFile]) - average1**2
print("The square of the standard deviation is:", variance)
print("The standard deviation is:", sqrt(variance))
#^Would square root of variance calculate the standard deviation?

plt.xlabel('x axis')
plt.ylabel('y axis')
plt.title('Plot of DataSet vs Row Numbers')
plt.plot(data)
plt.show()
Reply


Messages In This Thread
Estimating standard deviation from DataSet - by jomardee - Jan-22-2018, 11:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Estimating transition matrices in python Shreya10o 1 2,110 May-14-2020, 10:41 PM
Last Post: Larz60+
  creating new time series based on giving mean, standard deviation and skewness Staph 1 3,124 Aug-06-2019, 10:41 PM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020