statsmodels.emplike.descriptive.DescStatUV.test_var#
- DescStatUV.test_var(sig2_0, return_weights=False, *, result_object=None)[source]#
Returns -2 x log-likelihood ratio and the p-value for the hypothesized variance
- Parameters:
- sig2_0
float Hypothesized variance to be tested
- return_weightsbool,
optional If True, returns the weights that maximize the likelihood of observing sig2_0. Default is False
- result_objectbool,
optional Flag indicating whether to return the results as an
EmpLikeTestResultNamedTuple instead of a plain tuple. Whenreturn_weights=Truethe NamedTuple holds the same three elements as the legacy tuple, so it unpacks identically and is always returned, with no warning. Whenreturn_weights=Falsethe legacy two-element tuple is returned by default and aFutureWarningis issued.Deprecated since version 0.15.0: In release 0.16.0 or after July 2027, whichever is later, the default will change to always return an
EmpLikeTestResult. Setresult_object=Trueto opt in now, orresult_object=Falseto silence the warning and keep the current return type.
- sig2_0
- Returns:
EmpLikeTestResultortupleIf
result_object=Trueorreturn_weights=True, a NamedTuple with fieldsllr,pvalueandweights. SeeEmpLikeTestResult.Otherwise (the deprecated default), the plain
(llr, pvalue)tuple.
Examples
>>> import numpy as np >>> import statsmodels.api as sm >>> random_numbers = np.random.standard_normal(1000)*100 >>> el_analysis = sm.emplike.DescStat(random_numbers) >>> hyp_test = el_analysis.test_var(9500, result_object=True)