code: def test_pastes_vcomp(self):
      # pastes data from lme4
      #
      # Fit in R using:
      #
      # r = lmer(strength ~ (1|batch) + (1|batch:cask), data=data)
      # r = lmer(strength ~ (1|batch) + (1|batch:cask), data=data,
      #          reml=FALSE)
  
      cur_dir = os.path.dirname(os.path.abspath(__file__))
      rdir = os.path.join(cur_dir, "results")
      fname = os.path.join(rdir, "pastes.csv")
      data = pd.read_csv(fname)
      vcf = {"cask": "0 + cask"}
  
      # REML
      model = MixedLM.from_formula(
          "strength ~ 1",
          groups="batch",
          re_formula="1",
          vc_formula=vcf,
          data=data,
      )
      result = model.fit()
  
      # fixef(r)
      assert_allclose(result.fe_params.iloc[0], 60.0533, rtol=1e-3)
  
      # sqrt(diag(vcov(r)))
      assert_allclose(result.bse.iloc[0], 0.6769, rtol=1e-3)
  
      # VarCorr(r)$batch[[1]]
      assert_allclose(result.cov_re.iloc[0, 0], 1.657, rtol=1e-3)
  
      # attr(VarCorr(r), "sc")^2
      assert_allclose(result.scale, 0.678, rtol=1e-3)
  
      # logLik(r)
      assert_allclose(result.llf, -123.49, rtol=1e-1)
  
      # do not provide aic/bic with REML
      assert_equal(result.aic, np.nan)
      assert_equal(result.bic, np.nan)
  
      # resid(r)[1:5]
      resid = np.r_[
          0.17133538, -0.02866462, -1.08662875, 1.11337125, -0.12093607
      ]
      assert_allclose(result.resid[0:5], resid, rtol=1e-3)
  
      # predict(r)[1:5]
      fit = np.r_[62.62866, 62.62866, 61.18663, 61.18663, 62.82094]
      assert_allclose(result.fittedvalues[0:5], fit, rtol=1e-4)
  
      # ML
      model = MixedLM.from_formula(
          "strength ~ 1",
          groups="batch",
          re_formula="1",
          vc_formula=vcf,
          data=data,
      )
      result = model.fit(reml=False)
  
      # fixef(r)
      assert_allclose(result.fe_params.iloc[0], 60.0533, rtol=1e-3)
  
      # sqrt(diag(vcov(r)))
      assert_allclose(result.bse.iloc[0], 0.642, rtol=1e-3)
  
      # VarCorr(r)$batch[[1]]
      assert_allclose(result.cov_re.iloc[0, 0], 1.199, rtol=1e-3)
  
      # attr(VarCorr(r), "sc")^2
      assert_allclose(result.scale, 0.67799, rtol=1e-3)
  
      # logLik(r)
      assert_allclose(result.llf, -123.997, rtol=1e-1)
  
      # AIC(r)
      assert_allclose(result.aic, 255.9944, rtol=1e-3)
  
      # BIC(r)
      assert_allclose(result.bic, 264.3718, rtol=1e-3)
  
imports: from statsmodels.compat.platform import PLATFORM_OSX
  import os
  import csv
  import warnings
  import numpy
  import pandas
  from scipy import sparse
  import pytest
  from statsmodels.regression.mixed_linear_model import MixedLM, MixedLMParams, _smw_solver, _smw_logdet
  from numpy.testing import assert_almost_equal, assert_equal, assert_allclose, assert_
  from statsmodels.base import _penalties
  import statsmodels.tools.numdiff
  from .results import lme_r_results
label_desc: Use image node_id 11 for calling the TestMixedLM obj's underlying member method code with example usage: obj.test_pastes_vcomp() without return types