code: def test_multivariate_gam_1d_data():
      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
  
      df = [10]
      degree = [3]
      bsplines = BSplines(x, degree=degree, df=df)
      # y_mgcv is obtained from R with the following code
      # g = gam(y~s(x, k = 10, bs = "cr"), data = data, scale = 80)
      y_mgcv = data_from_r.y_est
  
      # alpha is by manually adjustment to reduce discrepancy in fittedvalues
      alpha = [0.0168 * 0.0251 / 2 * 500]
      gp = MultivariateGamPenalty(bsplines, alpha=alpha)  # noqa: F841
  
      glm_gam = GLMGam(
          y, exog=np.ones((len(y), 1)), smoother=bsplines, alpha=alpha
      )
      # "nm" converges to a different params, "bfgs" params are close to pirls
      # res_glm_gam = glm_gam.fit(method='nm', max_start_irls=0,
      #                           disp=1, maxiter=10000, maxfun=5000)
      res_glm_gam = glm_gam.fit(
          method="pirls", max_start_irls=0, disp=1, maxiter=10000
      )
      y_gam = res_glm_gam.fittedvalues
  
      # plt.plot(x, y_gam, '.', label='gam')
      # plt.plot(x, y_mgcv, '.', label='mgcv')
      # plt.plot(x, y, '.', label='y')
      # plt.legend()
      # plt.show()
  
      assert_allclose(y_gam, y_mgcv, atol=0.01)
  
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 15 for calling a global function with example usage: test_multivariate_gam_1d_data() without return types