code: def test_partial_values():
      # this test is only approximate because we do not use the same spline
      # basis functions (knots) as mgcv
      cur_dir = os.path.dirname(os.path.abspath(__file__))
      file_path = os.path.join(
          cur_dir, "results", "prediction_from_mgcv.csv"
      )
  
      data_from_r = pd.read_csv(file_path)
  
      # dataset used to train the R model
      x = data_from_r.x.values
      y = data_from_r.y.values
      se_from_mgcv = data_from_r.y_est_se
      df = [10]
      degree = [6]
      bsplines = BSplines(
          x, degree=degree, df=df, include_intercept=True
      )
  
      # TODO: alpha found by trial and error to pass assert
      alpha = 0.025 / 115 * 500
      glm_gam = GLMGam(y, smoother=bsplines, alpha=alpha)
      res_glm_gam = glm_gam.fit(maxiter=10000, method="bfgs")
      # TODO: if IRLS is used res_glm_gam has not partial_values.
  
      univ_bsplines = bsplines.smoothers[0]  # noqa: F841
      hat_y, se = res_glm_gam.partial_values(0)
  
      assert_allclose(hat_y, data_from_r["y_est"], rtol=0, atol=0.008)
      # TODO: bug missing scale
      bug_fact = np.sqrt(res_glm_gam.scale) * 0.976  # this is = 0.106
      assert_allclose(se, se_from_mgcv * bug_fact, rtol=0, atol=0.008)
  
imports: import os
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  from scipy.linalg import block_diag
  import pytest
  from statsmodels.tools.linalg import matrix_sqrt
  from statsmodels.gam.smooth_basis import UnivariatePolynomialSmoother, PolynomialSmoother, BSplines, GenericSmoothers, UnivariateCubicSplines, CyclicCubicSplines
  from statsmodels.gam.generalized_additive_model import GLMGam, LogitGam, make_augmented_matrix, penalized_wls
  from statsmodels.gam.gam_cross_validation.gam_cross_validation import MultivariateGAMCV, MultivariateGAMCVPath, _split_train_test_smoothers
  from statsmodels.gam.gam_penalties import UnivariateGamPenalty, MultivariateGamPenalty
  from statsmodels.gam.gam_cross_validation.cross_validators import KFold
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families.family import Gaussian
  from statsmodels.genmod.generalized_linear_model import lm
label_desc: Use image node_id 28 for calling a global function with example usage: test_partial_values() without return types