Get the estimated value at the specified quantile.

@param q
Queried quantile, e.g. 0.50 or 0.99.
@return Estimated value at that quantile.
434426
public synchronized double get(double q) {
        // clear the buffer
        insertBatch();
        compress();

        if (sample.size() == 0) {
            return Double.NaN;
        }

        int rankMin = 0;
        int desired = (int) (q * count);

        ListIterator<Item> it = sample.listIterator();
        Item prev, cur;
        cur = it.next();
        while (it.hasNext()) {
            prev = cur;
            cur = it.next();

            rankMin += prev.g;

            if (rankMin + cur.g + cur.delta > desired
                    + (allowableError(desired) / 2)) {
                return prev.value;
            }
        }

        // edge case of wanting max value
        return sample.getLast().value;
    }
549507
public double getValueAt(int k) {
    if (k < k_0) {
      return Double.POSITIVE_INFINITY;
    }
    return m * FastMath.log(k) + t;
  }
8472
def quantile_for_list_of_values(self, **kwargs):
        
        if self._is_transposed:
            kwargs["axis"] = kwargs.get("axis", 0) ^ 1
            return self.transpose().quantile_for_list_of_values(**kwargs)
        axis = kwargs.get("axis", 0)
        q = kwargs.get("q")
        numeric_only = kwargs.get("numeric_only", True)
        assert isinstance(q, (pandas.Series, np.ndarray, pandas.Index, list))

        if numeric_only:
            new_columns = self.numeric_columns()
        else:
            new_columns = [
                col
                for col, dtype in zip(self.columns, self.dtypes)
                if (is_numeric_dtype(dtype) or is_datetime_or_timedelta_dtype(dtype))
            ]
        if axis:
            # If along rows, then drop the nonnumeric columns, record the index, and
            # take transpose. We have to do this because if we don't, the result is all
            # in one column for some reason.
            nonnumeric = [
                col
                for col, dtype in zip(self.columns, self.dtypes)
                if not is_numeric_dtype(dtype)
            ]
            query_compiler = self.drop(columns=nonnumeric)
            new_columns = query_compiler.index
        else:
            query_compiler = self

        def quantile_builder(df, **kwargs):
            result = df.quantile(**kwargs)
            return result.T if axis == 1 else result

        func = query_compiler._prepare_method(quantile_builder, **kwargs)
        q_index = pandas.Float64Index(q)
        new_data = query_compiler._map_across_full_axis(axis, func)

        # This took a long time to debug, so here is the rundown of why this is needed.
        # Previously, we were operating on select indices, but that was broken. We were
        # not correctly setting the columns/index. Because of how we compute `to_pandas`
        # and because of the static nature of the index for `axis=1` it is easier to
        # just handle this as the transpose (see `quantile_builder` above for the
        # transpose within the partition) than it is to completely rework other
        # internal methods. Basically we are returning the transpose of the object for
        # correctness and cleanliness of the code.
        if axis == 1:
            q_index = new_columns
            new_columns = pandas.Float64Index(q)
        result = self.__constructor__(new_data, q_index, new_columns)
        return result.transpose() if axis == 1 else result
977953
def sumvalues(self, q=0):
        
        if q == 0:
            return self._totalf
        else:
            return -np.partition(-self._freq_list, q)[:q].sum()
1134830
private int sample(Queue<OutboundFrame> q) {
        packets.addAll(q);

        if (packets.size() < threshold) {
            return -1;
        }

        int sampleCount = min(samples, packets.size());
        int actualSampleCount = 0;
        for (int k = 0; k < sampleCount; k++) {
            OutboundFrame packet = packets.get(random.nextInt(packets.size()));
            String key = toKey(packet);

            if (key != null) {
                actualSampleCount++;
                occurrenceMap.add(key, 1);
            }
        }

        return actualSampleCount;
    }
853739
public static double quantile(double p, double k, double theta, double shift) {
    return FastMath.exp(GammaDistribution.quantile(p, k, theta)) + shift;
  }
52220
def q(self, val):
        
        self._q = np.asarray(val)
        self.Q = cumsum(val)
1086671
public static double quantile(double val, double rate) {
    return val >= 0 && val <= 1 ? -FastMath.log(1 - val) / rate : Double.NaN;
  }
627342
def value(self):
        
        if self.buffer:
            return np.quantile(self.buffer, self.quantile)
        else:
            return 0.0
193278
@Override
	public double getQuantileExpectation(double quantileStart, double quantileEnd) {
		return ((RandomVariableDifferentiableAADStochasticNonOptimized) getValues()).getValues().getQuantileExpectation(quantileStart, quantileEnd);
	}
588293
public DenseMatrix getQ() {
        int m = qr.nrows();
        int n = qr.ncols();
        DenseMatrix Q = Matrix.zeros(m, n);
        for (int k = n - 1; k >= 0; k--) {
            Q.set(k, k, 1.0);
            for (int j = k; j < n; j++) {
                if (qr.get(k, k) != 0) {
                    double s = 0.0;
                    for (int i = k; i < m; i++) {
                        s += qr.get(i, k) * Q.get(i, j);
                    }
                    s = -s / qr.get(k, k);
                    for (int i = k; i < m; i++) {
                        Q.add(i, j, s * qr.get(i, k));
                    }
                }
            }
        }
        return Q;
    }
1127643
public static double quantile(double val, double loc, double scale, double shape) {
    if(shape == 0.) {
      return loc - scale * FastMath.log((1 - val) / val);
    }
    return loc + scale * (1 - FastMath.pow((1 - val) / val, shape)) / shape;
  }
227857
def get_value(self):
        """"""
        # It is import to avoid accessing Qt C++ object as it has probably
        # already been destroyed, due to the Qt.WA_DeleteOnClose attribute
        df = self.dataModel.get_data()
        if self.is_series:
            return df.iloc[:, 0]
        else:
            return df
16503
public double quantile2tiled(double p) {
        if (p < 0.0 || p > 1.0) {
            throw new IllegalArgumentException("Invalid p: " + p);
        }

        double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu, 0.5, 1.0 - p);
        return Math.sqrt(nu * (1.0 - x) / x);
    }
989805
public static double quantile(double x, double mu, double sigma, double skew) {
    x = NormalDistribution.standardNormalQuantile(x);
    if(Math.abs(skew) > 0.) {
      x = (1. - FastMath.exp(-skew * x)) / skew;
    }
    return mu + sigma * x;
  }
1028218
public double getValueAt(int k) {
    double result = 0.;
    double log_k = FastMath.log(k), acc = 1.;
    for (int p = 0; p < b.length; p++) {
      result += b[p] * acc;
      acc *= log_k;
    }
    return result;
  }
1045101
def quantile(q, variable, weight_variable = None, filter_variable = None):
    
    def formula(entity, period):
        value = entity(variable, period)
        if weight_variable is not None:
            weight = entity(weight_variable, period)
        weight = entity.filled_array(1)
        if filter_variable is not None:
            filter_value = entity(filter_variable, period)
            weight = filter_value * weight

        labels = arange(1, q + 1)
        quantile, _ = weightedcalcs_quantiles(
            value,
            labels,
            weight,
            return_quantiles = True,
            )
        if filter_variable is not None:
            quantile = where(weight > 0, quantile, -1)
        return quantile

    return formula