首页 > 代码库 > Statistics and Linear Algebra 2

Statistics and Linear Algebra 2

1. The way to calculate the variance of a certain set of data:

  pts_mean = sum(nba_stats["pts"])/len(nba_stats[‘pts‘])
  point_variance = 0
  for i in nba_stats[‘pts‘]:
    difference = (i - pts_mean) ** 2
    point_variance += difference
  point_variance = point_variance / len(nba_stats[‘pts‘])

2. Something to the power has the highest pirority, then mutiply and devide, the add and subsract.

3. Raise 11 to the fifth power. Assign the result to e.(11**5)

  Take the fourth root of 10000. (10000**(1/4))

4. Use std() method to get the standard diviation:
  std_dev = nba_stats["pf"].std()

5. To get the normal distribution:

  from scipy.stats import norm

  points_two = np.arange(-10,10,0.1) #setup the x value by distributing from 100 points from -10 to 10 evenly.
  probabilities_two = norm.pdf(points_two,0,2) # get the normal distribution by using norm function 
  plt.plot(points,probabilities_two) # plot the points
  plt.show()

6. In the normal distribution:

  68% of the data is within 1 standard deviation of the mean, about 95% is within 2 standard deviations of the mean, and about 99% is   within 3 standard deviations of the mean

7.

 

Statistics and Linear Algebra 2