probability

SQL Server equivalent of Excel's TINV function

佐手、 提交于 2019-12-24 00:49:57
问题 I am trying to find two-tailed inverse of the X's t-distribution. It can be find using TINV function in Excel but I need this to achieve in SQL Sever. Please suggest me idea. The TINV function syntax has the following arguments: Probability : The probability associated with the two-tailed Student's t-distribution. Deg_freedom : The number of degrees of freedom with which to characterize the distribution. Ex: select tinv( 0.054645, 60); -- ----------------- -- 1.9599994129833 -- (1 row

Combining P values using Fisher method matlab?

浪尽此生 提交于 2019-12-23 21:16:22
问题 After doing CDF I received following values of P (Sample of them) [0.43 0.12 0.0021 0.05 0.017 0.001 0.025 0.038 0.35 0.29] I want to combine my P values with the help of Fisher method and get the output in the following way: Select first 3 P values and combines them and get result from this (using fisher method). For example, my first combine P value would be : 0.43 ,0.12 0.0021 and my next P combine value would be 0.12, 0.0021 ,0.05 and so on. Can anyone tell me how we can apply Fisher

Estimate pdf of a vector using Gaussian Kernel

懵懂的女人 提交于 2019-12-23 18:59:26
问题 I am using Gaussian kernel to estimate a pdf of a data based on the equation where K(.) is Gaussian kernel, data is a given vector. z is bin from 1 to 256. size of bin is 1. I implemented by matlab code. However, the result show the amplitude of my pdf estimation (blue color) is not similar with real pdf of data. Could you see my code and give me some comment about my code? MATLAB CODE function pdf_est=KDE() close all; %%Random values of 20 pixels, range=[1 256] data=randi([1 256],1,20); %%

Bloom Filter: evaluating false positive rate

不想你离开。 提交于 2019-12-23 05:23:35
问题 Given a fixed number of bits (eg. slot) (m) and a fixed number of hash function (k), how one compute the theoretical false positive rate (p) ? According to Wikipedia http://en.wikipedia.org/wiki/Bloom_filter, for a false positive rate (p) and a number of item (n), the number of bits (m) needed is given by m = - n * l(p) / (l(2)^2) and the optimal number of hash function (k) is given by k = m / n * l(2) . From the formula given in Wikipedia page, I guess I could evaluate the theoretical false

Normalize data in R data.frame column

流过昼夜 提交于 2019-12-23 03:48:11
问题 Suppose I have the following data: a <- data.frame(var1=letters,var2=runif(26)) Suppose I want to scale every value in var2 such that the sum of the var2 column is equal to 1 (basically turn the var2 column into a probability distribution) I have tried the following: a$var2 <- lapply(a$var2,function(x) (x-min(a$var2))/(max(a$var2)-min(a$var2))) this not only gives an overall sum greater than 1 but also turns the var2 column into a list on which I can't do operations like sum Is there any

How to get random number with each number has its own probability [duplicate]

最后都变了- 提交于 2019-12-23 00:25:17
问题 This question already has answers here : how to implement non uniform probability distribution? (3 answers) Closed 6 years ago . For example, I want to get random number from set S = {0, 1, 2, 3}. But instead of each number has same probability to shown (which is 25%), now I have different probability for each number, let say {50%, 30%, 20%, 10%}. How do I code this? In Java or C# (I prefer C#). 回答1: The Alias Method is by far my favorite for doing this. http://code.activestate.com/recipes

R, use binomial distribution with more than two possibilities

不打扰是莪最后的温柔 提交于 2019-12-22 17:49:04
问题 I know this is probably elementary, but I seem to have a mental block. Let's say you want to calculate the probability of tossing a 4, 5, or 6 on a roll of one die. In R, it's easy enough: sum(1/6, 1/6, 1/6) This gives 1/2 which is the correct answer. However, I have in the back of my mind (where it possibly should remain) that I should be able to use the binomial distribution for this. I've tried various combinations of arguments for pbinom and dbinom, but I can't get the right answer. With

Kalman filter prediction in case of missing measurement and only positions are known

扶醉桌前 提交于 2019-12-22 17:39:42
问题 I am trying to implement Kalman filter. I only know the positions. The measurements are missing at some time steps. This is how I define my matrices: Process noise matrix Q = np.diag([0.001, 0.001] ) Measurement noise matrix R = np.diag([10, 10]) Covariance matrix P = np.diag([0.001, 0.001]) Observation matirx H = np.array([[1.0, 0.0], [0.0, 1.0]]) Transition matrix F = np.array([[1, 0], [0, 1]]) state x = np.array([pos[0], [pos[1]]) I dont know if it is right. For instance, if I see target

Kalman filter prediction in case of missing measurement and only positions are known

笑着哭i 提交于 2019-12-22 17:38:02
问题 I am trying to implement Kalman filter. I only know the positions. The measurements are missing at some time steps. This is how I define my matrices: Process noise matrix Q = np.diag([0.001, 0.001] ) Measurement noise matrix R = np.diag([10, 10]) Covariance matrix P = np.diag([0.001, 0.001]) Observation matirx H = np.array([[1.0, 0.0], [0.0, 1.0]]) Transition matrix F = np.array([[1, 0], [0, 1]]) state x = np.array([pos[0], [pos[1]]) I dont know if it is right. For instance, if I see target

memory error by using rbf with scipy

瘦欲@ 提交于 2019-12-22 12:54:47
问题 I want to plot some points with the rbf function like here to get the density distribution of the points: if i run the following code, it works fine: from scipy.interpolate.rbf import Rbf # radial basis functions import cv2 import matplotlib.pyplot as plt import numpy as np # import data x = [1, 1, 2 ,3, 2, 7, 8, 6, 6, 7, 6.5, 7.5, 9, 8, 9, 8.5] y = [0, 2, 5, 6, 1, 2, 9, 2, 3, 3, 2.5, 2, 8, 8, 9, 8.5] d = np.ones(len(x)) print(d) ti = np.linspace(-1,10) xx, yy = np.meshgrid(ti, ti) rbf = Rbf