def get_formatted_mean_and_interval(self, interval_type='c', alpha=0.05, deci=0, form=None, multiplier=1): """ :param interval_type: (string) 'c' for t-based confidence interval, 'cb' for bootstrap confidence interval, and 'p' for percentile interval :param alpha: significance level :param deci: digits to round the numbers to :param form: ',' to format as number, '%' to format as percentage, and '$' to format as currency :param multiplier: to multiply the estimate and the interval by the provided value :return: (string) estimate and interval formatted as specified """ estimate = self.get_mean() * multiplier interval = self.get_interval(interval_type=interval_type, alpha=alpha, multiplier=multiplier) return F.format_estimate_interval(estimate=estimate, interval=interval, deci=deci, format=form)
def get_formatted_estimate_interval(self, interval_type='c', alpha=0.05, deci=0, form=None): """ :param interval_type: (string) 'c' for t-based confidence interval, 'cb' for bootstrap confidence interval, and 'p' for percentile interval :param alpha: significance level :param deci: digits to round the numbers to :param form: ',' to format as number, '%' to format as percentage, and '$' to format as currency :return: (string) estimate and interval formatted as specified """ estimate = self.get_mean() interval = self.get_interval(interval_type=interval_type, alpha=alpha) return F.format_estimate_interval(estimate, interval, deci, form)
import SimPy.FormatFunctions as Format print("\nFormatting estimates:") print(Format.format_number(12345.678,deci=1)) print(Format.format_number(12345.678, deci=1, format=Format.FormatNumber.NUMBER)) print(Format.format_number(12345.678, deci=1, format=Format.FormatNumber.CURRENCY)) print(Format.format_number(0.12345, deci=1, format=Format.FormatNumber.PERCENTAGE)) print("\nFormatting intervals:") print(Format.format_interval([12345.678, 98765.432],deci=1)) print(Format.format_interval([12345.678, 98765.432], deci=1, format=Format.FormatNumber.NUMBER)) print(Format.format_interval([12345.678, 98765.432], deci=1, format=Format.FormatNumber.CURRENCY)) print(Format.format_interval([0.12345, 0.98765], deci=1, format=Format.FormatNumber.PERCENTAGE)) print("\nFormatting estimates and intervals:") print(Format.format_estimate_interval( estimate=5555.55, interval=[12345.678, 98765.432],deci=1)) print(Format.format_estimate_interval( estimate=5555.55, interval=[12345.678, 98765.432], deci=1, format=Format.FormatNumber.NUMBER)) print(Format.format_estimate_interval( estimate=5555.55, interval=[12345.678, 98765.432], deci=1, format=Format.FormatNumber.CURRENCY)) print(Format.format_estimate_interval( estimate=0.5555, interval=[0.12345, 0.98765], deci=1, format=Format.FormatNumber.PERCENTAGE))