{"id":19446116,"url":"https://github.com/stitchfix/momentmixedmodels","last_synced_at":"2025-10-12T20:11:42.629Z","repository":{"id":143399489,"uuid":"136097998","full_name":"stitchfix/MomentMixedModels","owner":"stitchfix","description":"A Spark/Scala package for Moment-Based Estimation For Hierarchical Models","archived":false,"fork":false,"pushed_at":"2019-07-08T16:52:20.000Z","size":49,"stargazers_count":15,"open_issues_count":5,"forks_count":2,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-25T01:42:40.306Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stitchfix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-05T00:33:45.000Z","updated_at":"2022-04-07T23:40:35.000Z","dependencies_parsed_at":"2023-09-17T03:34:03.313Z","dependency_job_id":null,"html_url":"https://github.com/stitchfix/MomentMixedModels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stitchfix/MomentMixedModels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2FMomentMixedModels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2FMomentMixedModels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2FMomentMixedModels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2FMomentMixedModels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stitchfix","download_url":"https://codeload.github.com/stitchfix/MomentMixedModels/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2FMomentMixedModels/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012797,"owners_count":26085187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:12:58.130Z","updated_at":"2025-10-12T20:11:42.611Z","avatar_url":"https://github.com/stitchfix.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MomentMixedModels\n\nA Spark/Scala package for Moment-Based Estimation For Hierarchical Models. Based off the the\n[mbest](https://cran.r-project.org/web/packages/mbest/index.html) R package, and\n[(Patrick O. Perry 2015)](https://arxiv.org/abs/1504.04941). The package currently only supports linear and logistic\nregression.\n\nSee the `Examples` object internally for examples of fitting local models.\n```scala\n  lazy val localSpark: SparkSession = {\n    SparkSession\n      .builder()\n      .master(\"local\")\n      .appName(\"spark test example\")\n      .getOrCreate()\n  }\n\n  val sleepstudySchema = StructType(Array(\n    StructField(\"Reaction\", DoubleType, true),\n    StructField(\"Days\", DoubleType, true),\n    StructField(\"Subject\", StringType, true)))\n\n  val sleepstudyData = {\n    localSpark\n      .read.format(\"csv\")\n      .option(\"header\", \"true\")\n      .schema(sleepstudySchema)\n      .load(\"data/sleepstudy.csv\")\n  }\n\n  val linearModelFitter = {\n    new MixedEffectsRegression()\n      .setResponseCol(\"Reaction\")\n      .setFixedEffectCols(Seq(\"Days\"))\n      .setRandomEffectCols(Seq(\"Days\"))\n      .setFamilyParam(\"gaussian\")\n      .setGroupCol(\"Subject\")\n  }\n\n  val linearModel = linearModelFitter.fit(sleepstudyData)\n  println(linearModel.β)\n  // DenseVector(251.40510484848477, 10.467285959595985)\n  println(linearModel.φ)\n  // 654.9410270722987\n  println(linearModel.Σ)\n  // 565.5153668031181   11.055429022598702\n  // 11.055429022598702  32.68219718640934\n  println(linearModel.randomEffects(\"310\"))\n  // DenseVector(-38.43315312500708, -5.513378956616419)\n```\n\n## Future Development\n\nThe current documentation is quite sparse. We'll gladly accept requests to fix and improve documentation! We will also\ngladly accept feature requestes and pull requests.\n\nPlease report issues directly on Github, that would be a really useful contribution given that we lack some user\ntesting for this project. Please document as much as possible the steps to reproduce your problem\n(even better with screenshots).\n\n\n## License\n\nWe’re using the [Apache 2.0](./LICENSE) license.\n\n## Authors\n- [Kyle Schmaus](https://github.com/kschmaus)\n- [Alexander Demidko](https://github.com/xdralex)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchfix%2Fmomentmixedmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstitchfix%2Fmomentmixedmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchfix%2Fmomentmixedmodels/lists"}