Python Forum
Estimating standard deviation from DataSet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Estimating standard deviation from DataSet
#3
Here is the code, apologize for the delay. Yes it is also a bunch of noise where the problem asks;

Make a plot of your data in DataSet1 vs. row number. From your plot, estimate the standard deviation of your data, i.e. how far the points scatter from the average and record your value. Now write a program to calculate the standard deviation (don’t use built in functions this time). Discuss how well your estimate matches your calculated value. Every time we make a measurement, a value of the noise gets determined at random. This is a bit like quantum mechanics, where when we make a measurement of, say, position, the value is determined randomly. In quantum mechanics the probability of measuring different positions is drawn from a probability distribution given by the complex square of the wave function, P(x) = |Ψ|^2, so that the probability of measuring a position between x1 and x2 is given by the area under the P(x) curve between x1 and x2

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


variance = 0.0
standDev = 0.0
summ = 0
sum_sq = 0
average = 0

textFile = open('DataSet1.dat','r')
file = textFile.readlines()
dataSet = [float(i) for i in file]

for i in range(0, len(dataSet)):
    array1[i] = file.readline()
    average  += (sum(array1)/len(array1)
print("The average is:", average)

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


Messages In This Thread
RE: Estimating standard deviation from DataSet - by jomardee - Jan-24-2018, 01:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Estimating transition matrices in python Shreya10o 1 2,098 May-14-2020, 10:41 PM
Last Post: Larz60+
  creating new time series based on giving mean, standard deviation and skewness Staph 1 3,111 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