class_docstr: Class to contain results of fitting a linear mixed effects model.
  
  MixedLMResults inherits from statsmodels.LikelihoodModelResults
  
  Parameters
  ----------
  See statsmodels.LikelihoodModelResults
  
  Attributes
  ----------
  model : class instance
      Pointer to MixedLM model instance that called fit.
  normalized_cov_params : ndarray
      The sampling covariance matrix of the estimates
  params : ndarray
      A packed parameter vector for the profile parameterization.
      The first `k_fe` elements are the estimated fixed effects
      coefficients.  The remaining elements are the estimated
      variance parameters.  The variance parameters are all divided
      by `scale` and are not the variance parameters shown
      in the summary.
  fe_params : ndarray
      The fitted fixed-effects coefficients
  cov_re : ndarray
      The fitted random-effects covariance matrix
  bse_fe : ndarray
      The standard errors of the fitted fixed effects coefficients
  bse_re : ndarray
      The standard errors of the fitted random effects covariance
      matrix and variance components.  The first `k_re * (k_re + 1)`
      parameters are the standard errors for the lower triangle of
      `cov_re`, the remaining elements are the standard errors for
      the variance components.
  
  See Also
  --------
  statsmodels.LikelihoodModelResults
class_docstr_tok: ["Class","to","contain","results","of","fitting","a","linear","mixed","effects","model",".","MixedLMResults","inherits","from","statsmodels.LikelihoodModelResults","Parameters","--","--","--","--","--","See","statsmodels.LikelihoodModelResults","Attributes","--","--","--","--","--","model",":","class","instance","Pointer","to","MixedLM","model","instance","that","called","fit",".","normalized_cov_params",":","ndarray","The","sampling","covariance","matrix","of","the","estimates","params",":","ndarray","A","packed","parameter","vector","for","the","profile","parameterization",".","The","first","`","k_fe","`","elements","are","the","estimated","fixed","effects","coefficients",".","The","remaining","elements","are","the","estimated","variance","parameters",".","The","variance","parameters","are","all","divided","by","`","scale","`","and","are","not","the","variance","parameters","shown","in","the","summary",".","fe_params",":","ndarray","The","fitted","fixed-effects","coefficients","cov_re",":","ndarray","The","fitted","random-effects","covariance","matrix","bse_fe",":","ndarray","The","standard","errors","of","the","fitted","fixed","effects","coefficients","bse_re",":","ndarray","The","standard","errors","of","the","fitted","random","effects","covariance","matrix","and","variance","components",".","The","first","`","k_re","*","(","k_re","+","1",")","`","parameters","are","the","standard","errors","for","the","lower","triangle","of","`","cov_re","`",",","the","remaining","elements","are","the","standard","errors","for","the","variance","components",".","See","Also","--","--","--","--","statsmodels.LikelihoodModelResults"]
docstr: Profile-likelihood inference for variance parameters.
  
  Parameters
  ----------
  re_ix : int
      If vtype is `re`, this value is the index of the variance
      parameter for which to construct a profile likelihood.  If
      `vtype` is 'vc' then `re_ix` is the name of the variance
      parameter to be profiled.
  vtype : str
      Either 're' or 'vc', depending on whether the profile
      analysis is for a random effect or a variance component.
  num_low : int
      The number of points at which to calculate the likelihood
      below the MLE of the parameter of interest.
  dist_low : float
      The distance below the MLE of the parameter of interest to
      begin calculating points on the profile likelihood.
  num_high : int
      The number of points at which to calculate the likelihood
      above the MLE of the parameter of interest.
  dist_high : float
      The distance above the MLE of the parameter of interest to
      begin calculating points on the profile likelihood.
  **fit_kwargs
      Additional keyword arguments passed to fit.
  
  Returns
  -------
  An array with two columns.  The first column contains the
  values to which the parameter of interest is constrained.  The
  second column contains the corresponding likelihood values.
  
  Notes
  -----
  Only variance parameters can be profiled.
docstr_tok: ["Profile-likelihood","inference","for","variance","parameters",".","Parameters","--","--","--","--","--","re_ix",":","int","If","vtype","is","`","re","`",",","this","value","is","the","index","of","the","variance","parameter","for","which","to","construct","a","profile","likelihood",".","If","`","vtype","`","is","'vc","'","then","`","re_ix","`","is","the","name","of","the","variance","parameter","to","be","profiled",".","vtype",":","str","Either","'re","'","or","'vc","'",",","depending","on","whether","the","profile","analysis","is","for","a","random","effect","or","a","variance","component",".","num_low",":","int","The","number","of","points","at","which","to","calculate","the","likelihood","below","the","MLE","of","the","parameter","of","interest",".","dist_low",":","float","The","distance","below","the","MLE","of","the","parameter","of","interest","to","begin","calculating","points","on","the","profile","likelihood",".","num_high",":","int","The","number","of","points","at","which","to","calculate","the","likelihood","above","the","MLE","of","the","parameter","of","interest",".","dist_high",":","float","The","distance","above","the","MLE","of","the","parameter","of","interest","to","begin","calculating","points","on","the","profile","likelihood",".","*","*","fit_kwargs","Additional","keyword","arguments","passed","to","fit",".","Returns","--","--","--","-","An","array","with","two","columns",".","The","first","column","contains","the","values","to","which","the","parameter","of","interest","is","constrained",".","The","second","column","contains","the","corresponding","likelihood","values",".","Notes","--","--","-","Only","variance","parameters","can","be","profiled","."]
code: def profile_re(
      self,
      re_ix,
      vtype,
      num_low=5,
      dist_low=1.0,
      num_high=5,
      dist_high=1.0,
      **fit_kwargs,
  ):
      """
      Profile-likelihood inference for variance parameters.
  
      Parameters
      ----------
      re_ix : int
          If vtype is `re`, this value is the index of the variance
          parameter for which to construct a profile likelihood.  If
          `vtype` is 'vc' then `re_ix` is the name of the variance
          parameter to be profiled.
      vtype : str
          Either 're' or 'vc', depending on whether the profile
          analysis is for a random effect or a variance component.
      num_low : int
          The number of points at which to calculate the likelihood
          below the MLE of the parameter of interest.
      dist_low : float
          The distance below the MLE of the parameter of interest to
          begin calculating points on the profile likelihood.
      num_high : int
          The number of points at which to calculate the likelihood
          above the MLE of the parameter of interest.
      dist_high : float
          The distance above the MLE of the parameter of interest to
          begin calculating points on the profile likelihood.
      **fit_kwargs
          Additional keyword arguments passed to fit.
  
      Returns
      -------
      An array with two columns.  The first column contains the
      values to which the parameter of interest is constrained.  The
      second column contains the corresponding likelihood values.
  
      Notes
      -----
      Only variance parameters can be profiled.
      """
  
      pmodel = self.model
      k_fe = pmodel.k_fe
      k_re = pmodel.k_re
      k_vc = pmodel.k_vc
      endog, exog = pmodel.endog, pmodel.exog
  
      # Need to permute the columns of the random effects design
      # matrix so that the profiled variable is in the first column.
      if vtype == "re":
          ix = np.arange(k_re)
          ix[0] = re_ix
          ix[re_ix] = 0
          exog_re = pmodel.exog_re.copy()[:, ix]
  
          # Permute the covariance structure to match the permuted
          # design matrix.
          params = self.params_object.copy()
          cov_re_unscaled = params.cov_re
          cov_re_unscaled = cov_re_unscaled[np.ix_(ix, ix)]
          params.cov_re = cov_re_unscaled
          ru0 = cov_re_unscaled[0, 0]
  
          # Convert dist_low and dist_high to the profile
          # parameterization
          cov_re = self.scale * cov_re_unscaled
          low = (cov_re[0, 0] - dist_low) / self.scale
          high = (cov_re[0, 0] + dist_high) / self.scale
  
      elif vtype == "vc":
          re_ix = self.model.exog_vc.names.index(re_ix)
          params = self.params_object.copy()
          vcomp = self.vcomp
          low = (vcomp[re_ix] - dist_low) / self.scale
          high = (vcomp[re_ix] + dist_high) / self.scale
          ru0 = vcomp[re_ix] / self.scale
  
      # Define the sequence of values to which the parameter of
      # interest will be constrained.
      if low <= 0:
          raise ValueError(
              "dist_low is too large and would result in a "
              "negative variance. Try a smaller value."
          )
      left = np.linspace(low, ru0, num_low + 1)
      right = np.linspace(ru0, high, num_high + 1)[1:]
      rvalues = np.concatenate((left, right))
  
      # Indicators of which parameters are free and fixed.
      free = MixedLMParams(k_fe, k_re, k_vc)
      if self.freepat is None:
          free.fe_params = np.ones(k_fe)
          vcomp = np.ones(k_vc)
          mat = np.ones((k_re, k_re))
      else:
          # If a freepat already has been specified, we add the
          # constraint to it.
          free.fe_params = self.freepat.fe_params
          vcomp = self.freepat.vcomp
          mat = self.freepat.cov_re
          if vtype == "re":
              mat = mat[np.ix_(ix, ix)]
      if vtype == "re":
          mat[0, 0] = 0
      else:
          vcomp[re_ix] = 0
      free.cov_re = mat
      free.vcomp = vcomp
  
      klass = self.model.__class__
      init_kwargs = pmodel._get_init_kwds()
      if vtype == "re":
          init_kwargs["exog_re"] = exog_re
  
      likev = []
      for x in rvalues:
          model = klass(endog, exog, **init_kwargs)
  
          if vtype == "re":
              cov_re = params.cov_re.copy()
              cov_re[0, 0] = x
              params.cov_re = cov_re
          else:
              params.vcomp[re_ix] = x
  
          # TODO should use fit_kwargs
          rslt = model.fit(
              start_params=params,
              free=free,
              reml=self.reml,
              cov_pen=self.cov_pen,
              **fit_kwargs,
          )._results
          likev.append([x * rslt.scale, rslt.llf])
  
      likev = np.asarray(likev)
  
      return likev
  
imports: import warnings
  import numpy
  import pandas
  import patsy
  from scipy import sparse
  from scipy.stats.distributions import norm
  from statsmodels.base._penalties import Penalty
  import statsmodels.base.model
  from statsmodels.tools import data
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.tools.sm_exceptions import ConvergenceWarning
label_desc: Use image node_id 14 for calling the MixedLMResults obj's underlying member method code with example usage: obj.profile_re(re_ix, vtype, num_low, dist_low, num_high, dist_high) and returns: likev