# Statistics

**URL:** https://discourse.julialang.org/c/domain/stats/12.md?page=3

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 4

---

## [Weighted PCA with MultivariateStats.jl](https://discourse.julialang.org/t/weighted-pca-with-multivariatestats-jl/113525)

<div class="topic-metadata">

**Author:** [@njacki](https://discourse.julialang.org/u/njacki)\
**Replies:** 0\
**Last updated:** [April 26, 2024, 9:26am UTC](https://discourse.julialang.org/t/weighted-pca-with-multivariatestats-jl/113525 "2024-04-26T09:26:54Z")

</div>

Hi, I want to perfrom PCA on my dataset and assign possible different weights to my variables. According to Jolliffe (2002), this can be easily done when the weighting matrix can be factorized, i.e., W\_{ij} = \\omega\_i …

---

## [RFC: ClusteringAPI.jl](https://discourse.julialang.org/t/rfc-clusteringapi-jl/112258)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 27\
**Last updated:** [April 18, 2024, 9:11pm UTC](https://discourse.julialang.org/t/rfc-clusteringapi-jl/112258 "2024-04-18T21:11:54Z")

</div>

Hi all, this could go either in statistics, data, or machine learning domains, please share. Alright, so I was trying to test various different clustering algorithms to see which one best clusters my data. In doing so,…

---

## [How to extract the upper/lower triangular matrix values except the diagonal?](https://discourse.julialang.org/t/how-to-extract-the-upper-lower-triangular-matrix-values-except-the-diagonal/112974)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 4\
**Last updated:** [April 15, 2024, 6:07pm UTC](https://discourse.julialang.org/t/how-to-extract-the-upper-lower-triangular-matrix-values-except-the-diagonal/112974 "2024-04-15T18:07:52Z")

</div>

Consider the following matrix: julia\> c = rand(2, 2) 2×2 Matrix{Float64}: 0.0443768 0.515352 0.531426 0.967584 Expected output: 1-element Vector{Float64}: 0.531426 I can do: julia\> using LinearAlgebra: LowerTri…

---

## [Testing multimodal distribution](https://discourse.julialang.org/t/testing-multimodal-distribution/44346)

<div class="topic-metadata">

**Author:** [@Dario\_Sarra](https://discourse.julialang.org/u/Dario_Sarra)\
**Replies:** 5\
**Last updated:** [April 12, 2024, 12:21pm UTC](https://discourse.julialang.org/t/testing-multimodal-distribution/44346 "2024-04-12T12:21:42Z")

</div>

I am trying to find implementations of any statistical method to test whether a sample is unimodal or multimodal distributed. From Wikipedia Multimodal Distribution, you can find multiple example of such tests. In parti…

---

## [Tips for Estimating Non-linear Latent SDE](https://discourse.julialang.org/t/tips-for-estimating-non-linear-latent-sde/104326)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 1\
**Last updated:** [April 7, 2024, 1:42pm UTC](https://discourse.julialang.org/t/tips-for-estimating-non-linear-latent-sde/104326 "2024-04-07T13:42:20Z")

</div>

I was hoping to use Turing.jl alongside DifferentialEquations.jl to estimate a partially observable SDE via quasi-likelihood methods. Being new to continuous-time models, I was hoping to get some suggestions on the most …

---

## [In search for a Julia analog of an R's package](https://discourse.julialang.org/t/in-search-for-a-julia-analog-of-an-rs-package/112413)

<div class="topic-metadata">

**Author:** [@vvbond](https://discourse.julialang.org/u/vvbond)\
**Replies:** 4\
**Last updated:** [April 2, 2024, 1:31pm UTC](https://discourse.julialang.org/t/in-search-for-a-julia-analog-of-an-rs-package/112413 "2024-04-02T13:31:44Z")

</div>

My question is motivated by the need for a quick Deming regression computation. In R, it is included in the mcr, Method Comparison Regression, package. Alas, my search for a Julia’s alternative wasn’t successful, despit…

---

## [Inferring missing values in a Turing.jl model](https://discourse.julialang.org/t/inferring-missing-values-in-a-turing-jl-model/112166)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 1\
**Last updated:** [March 27, 2024, 4:48am UTC](https://discourse.julialang.org/t/inferring-missing-values-in-a-turing-jl-model/112166 "2024-03-27T04:48:15Z")

</div>

I have a very simple model that doesn’t seem to work when I try to infer values for missing variable. I will try to explain the model and provide fully reproducible, self-contained code. I know it’s long post but I’ve br…

---

## [What is the equivalent Julia code for statsmodels.api.OLS](https://discourse.julialang.org/t/what-is-the-equivalent-julia-code-for-statsmodels-api-ols/112070)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 15\
**Last updated:** [March 26, 2024, 10:17pm UTC](https://discourse.julialang.org/t/what-is-the-equivalent-julia-code-for-statsmodels-api-ols/112070 "2024-03-26T22:17:58Z")

</div>

I want to write the equivalent Julia code for the following Python code: import statsmodels.api as sm reg = sm.OLS(Y,sm.add\_constant(X)) res = reg.fit() res.params\[1\]/res.bse\[1\] The copilot asserts that the equivalent …

---

## [\[ANN\] NestedTerms.jl - concept](https://discourse.julialang.org/t/ann-nestedterms-jl-concept/112051)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 0\
**Last updated:** [March 24, 2024, 8:54pm UTC](https://discourse.julialang.org/t/ann-nestedterms-jl-concept/112051 "2024-03-24T20:54:03Z")

</div>

NestedTerms.jl is a concept package for correct nested terms fitting . Install import Pkg Pkg.add(url = "https://github.com/PharmCat/NestedTerms.jl.git") Example using NestedTerms using StatsModels, CSV, DataFrames, Ca…

---

## [Bayesian Design of Experiment in Julia](https://discourse.julialang.org/t/bayesian-design-of-experiment-in-julia/106372)

<div class="topic-metadata">

**Author:** [@Dreycen\_Foiles](https://discourse.julialang.org/u/Dreycen_Foiles)\
**Replies:** 1\
**Last updated:** [March 22, 2024, 1:00pm UTC](https://discourse.julialang.org/t/bayesian-design-of-experiment-in-julia/106372 "2024-03-22T13:00:22Z")

</div>

I’m learning more about Bayesian experimental design and I’d be interested to know if anyone has experience doing something like this in Julia. Specifically, I’m looking for anything like this Pyro tutorial on an adapati…

---

## [Efficient dataframe operations \[unclear task\]](https://discourse.julialang.org/t/efficient-dataframe-operations-unclear-task/111925)

<div class="topic-metadata">

**Author:** [@haidangel](https://discourse.julialang.org/u/haidangel)\
**Replies:** 2\
**Last updated:** [March 21, 2024, 12:47pm UTC](https://discourse.julialang.org/t/efficient-dataframe-operations-unclear-task/111925 "2024-03-21T12:47:19Z")

</div>

I have a dataframe with 2715 attribute columns, values ranging from \[0, 0.92). Additionally, the dataframe has an auxiliary attribute column with one-hot values (0 or 1) for a binary classification task. I want to use Ju…

---

## [Is there a way to calculate eigenvalues for symbolic matrices?](https://discourse.julialang.org/t/is-there-a-way-to-calculate-eigenvalues-for-symbolic-matrices/110818)

<div class="topic-metadata">

**Author:** [@swsw](https://discourse.julialang.org/u/swsw)\
**Replies:** 5\
**Last updated:** [March 21, 2024, 2:43am UTC](https://discourse.julialang.org/t/is-there-a-way-to-calculate-eigenvalues-for-symbolic-matrices/110818 "2024-03-21T02:43:15Z")

</div>

I’d like to calculate the eigenvalues for the matrix like \[1 1; x x\] in julia. is there a way to do it? I tried the following but didn’t work. using SymPy @syms x A = \[1 1; x x\] eigen(A)

---

## [Score function Mittag-Leffler pdf](https://discourse.julialang.org/t/score-function-mittag-leffler-pdf/111724)

<div class="topic-metadata">

**Author:** [@aner-sanchez](https://discourse.julialang.org/u/aner-sanchez)\
**Replies:** 0\
**Last updated:** [March 17, 2024, 2:53pm UTC](https://discourse.julialang.org/t/score-function-mittag-leffler-pdf/111724 "2024-03-17T14:53:44Z")

</div>

Good sunday to everyone, I’ve been trying to compute the score function of the Mittag-Leffler distribution given by the pdf f(t;\\alpha,d)=d t^{\\alpha -1}E\_{\\alpha,\\alpha}(-dt^\\alpha);\\quad d,t\>0,\\quad \\alpha\\in(0,1) w…

---

## [Expressing multivariate repsonse with StatsModels.@formula](https://discourse.julialang.org/t/expressing-multivariate-repsonse-with-statsmodels-formula/111705)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 0\
**Last updated:** [March 16, 2024, 7:08pm UTC](https://discourse.julialang.org/t/expressing-multivariate-repsonse-with-statsmodels-formula/111705 "2024-03-16T19:08:03Z")

</div>

Hi all, I’m trying to model a multivariate response variable using GLM.jl (and potentially MixedModels.jl at a later point). I know that there isn’t first-class support for this, but people usually suggest introducing a…

---

## [NaNs during MCMC sampling?](https://discourse.julialang.org/t/nans-during-mcmc-sampling/111530)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 2\
**Last updated:** [March 15, 2024, 6:09am UTC](https://discourse.julialang.org/t/nans-during-mcmc-sampling/111530 "2024-03-15T06:09:40Z")

</div>

Hi, I’m trying to perform model calibration with MCMC. When sampling from my posterior, I find that after about 1 sample, the MCMC sampler produces NaNs. I’m quiet new to MCMC sampling and am wondering whether there ar…

---

## [Is the use of DAGs in causal inference commonplace?](https://discourse.julialang.org/t/is-the-use-of-dags-in-causal-inference-commonplace/108984)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 7\
**Last updated:** [March 10, 2024, 10:45am UTC](https://discourse.julialang.org/t/is-the-use-of-dags-in-causal-inference-commonplace/108984 "2024-03-10T10:45:09Z")

</div>

A few years ago I worked through Richard McElreath’s Statistical Rethinking. In it, McElreath discusses the use of Directed Acyclic Graphs to specify/analyze causal models, briefly covers do-calculus, etc. I don’t work i…

---

## [Survival analysis in Julia](https://discourse.julialang.org/t/survival-analysis-in-julia/969)

<div class="topic-metadata">

**Author:** [@piever](https://discourse.julialang.org/u/piever)\
**Replies:** 22\
**Last updated:** [March 1, 2024, 12:33pm UTC](https://discourse.julialang.org/t/survival-analysis-in-julia/969 "2024-03-01T12:33:11Z")

</div>

Hi all, What are good packages for survival analysis in Julia (i.e. working with truncated data, Kaplan-Meier estimator, Cox model and so on…)? So far I only found packages that seemed incomplete/abandoned (e.g.\[https:/…

---

## [Issue with the Metropolis adjusted Langevin sampler from AdvancedMH.jl](https://discourse.julialang.org/t/issue-with-the-metropolis-adjusted-langevin-sampler-from-advancedmh-jl/110155)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [February 13, 2024, 10:13pm UTC](https://discourse.julialang.org/t/issue-with-the-metropolis-adjusted-langevin-sampler-from-advancedmh-jl/110155 "2024-02-13T22:13:39Z")

</div>

I am trying to use a Metropolis adjusted Langevin sampler, from AdvancedMH.MALA. I did a simple test to see if things are working correctly, which is to sample from a multivariate normal distribution. Here is the code: i…

---

## [Major update of my Financial Econometrics Repository](https://discourse.julialang.org/t/major-update-of-my-financial-econometrics-repository/109368)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 1\
**Last updated:** [January 28, 2024, 8:31pm UTC](https://discourse.julialang.org/t/major-update-of-my-financial-econometrics-repository/109368 "2024-01-28T20:31:03Z")

</div>

Dear Julians, I have made a major update of my financial econometrics repository, aimed at late MA/early PhD students in finance. It covers things from OLS to quantile regressions (via MLE, GMM, kernel regressions). Eac…

---

## [Make model matrix with raw data (Non-Real, Complex numbers and other structures) in StatsModels and possible application with Metida (spatial covariance with shortest path)](https://discourse.julialang.org/t/make-model-matrix-with-raw-data-non-real-complex-numbers-and-other-structures-in-statsmodels-and-possible-application-with-metida-spatial-covariance-with-shortest-path/109123)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 1\
**Last updated:** [January 23, 2024, 6:43pm UTC](https://discourse.julialang.org/t/make-model-matrix-with-raw-data-non-real-complex-numbers-and-other-structures-in-statsmodels-and-possible-application-with-metida-spatial-covariance-with-shortest-path/109123 "2024-01-23T18:43:44Z")

</div>

Is it possible to use Complex numbers and custom types in StatsModels as continuous variables?

---

## [Beta-Binomial Bayesian Model - larger samples result in more uncertainty?](https://discourse.julialang.org/t/beta-binomial-bayesian-model-larger-samples-result-in-more-uncertainty/108314)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 1\
**Last updated:** [January 3, 2024, 6:43pm UTC](https://discourse.julialang.org/t/beta-binomial-bayesian-model-larger-samples-result-in-more-uncertainty/108314 "2024-01-03T18:43:23Z")

</div>

I have a question about the Beta-Binomial Bayesian model. Let’s say I’d like to implement some quality control using this method. Based on a previous review of 10 widgets, I start with the prior belief that 90% of widget…

---

## [Piecewise linear regression with automatic knot selection](https://discourse.julialang.org/t/piecewise-linear-regression-with-automatic-knot-selection/93984)

<div class="topic-metadata">

**Author:** [@meghapatnaik](https://discourse.julialang.org/u/meghapatnaik)\
**Replies:** 9\
**Last updated:** [January 2, 2024, 8:42pm UTC](https://discourse.julialang.org/t/piecewise-linear-regression-with-automatic-knot-selection/93984 "2024-01-02T20:42:04Z")

</div>

Hi everyone, I am new to Julia, mostly work with R. I am looking for the equivalent of the “segmented” package in R, to fit a piecewise linear (constant in my special case) regression where the knot location is automate…

---

## [How to remove specific collumn from ModelFrame (StatsModels.jl)?](https://discourse.julialang.org/t/how-to-remove-specific-collumn-from-modelframe-statsmodels-jl/106864)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 11\
**Last updated:** [December 24, 2023, 2:32pm UTC](https://discourse.julialang.org/t/how-to-remove-specific-collumn-from-modelframe-statsmodels-jl/106864 "2023-12-24T14:32:55Z")

</div>

Hello! I have ModelFrame from data: mf = ModelFrame(@formula(y ~ 1 + x\*y), df)) where ‘x’ and ‘y’ - categorical. But I have rank-deficient modelmatrix(mf) and want to drop rank-deficient columns, I can identify them…

---

## [Question About Intercept & Link Function in Bayesian Logistic Regression](https://discourse.julialang.org/t/question-about-intercept-link-function-in-bayesian-logistic-regression/105596)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 7\
**Last updated:** [December 17, 2023, 1:28am UTC](https://discourse.julialang.org/t/question-about-intercept-link-function-in-bayesian-logistic-regression/105596 "2023-12-17T01:28:15Z")

</div>

Assume the following: I repeat a game over and over in which I roll a die a number of times. If I roll a 6 on any of the trials, I win. Otherwise, I lose. I want to model how the probability of winning this game changes …

---

## [Regularized horseshoe prior](https://discourse.julialang.org/t/regularized-horseshoe-prior/71599)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 10\
**Last updated:** [December 15, 2023, 8:13pm UTC](https://discourse.julialang.org/t/regularized-horseshoe-prior/71599 "2023-12-15T20:13:10Z")

</div>

Anyone here who has some working Turing.jl (or Soss.jl) code for the regularized horseshoe prior (e.g., Piironen, 2007)? The horseshoe prior is a regularization technique (reduces the chance of overfitting) for when the…

---

## [RE: Weighted Statistics with Missings](https://discourse.julialang.org/t/re-weighted-statistics-with-missings/107502)

<div class="topic-metadata">

**Author:** [@gaspardelanuit](https://discourse.julialang.org/u/gaspardelanuit)\
**Replies:** 19\
**Last updated:** [December 13, 2023, 4:51pm UTC](https://discourse.julialang.org/t/re-weighted-statistics-with-missings/107502 "2023-12-13T16:51:34Z")

</div>

There was a post on this topic a few years ago. I ran into this recently and thought this would be occasion to mention it again. I have not found an idiomatic way to solve the problem and from discussions of how to imp…

---

## [Nesting the GLM.jl in the objective function when formulating the ReverseDiff gradient generates StackOverflowError](https://discourse.julialang.org/t/nesting-the-glm-jl-in-the-objective-function-when-formulating-the-reversediff-gradient-generates-stackoverflowerror/107050)

<div class="topic-metadata">

**Author:** [@xxxxx](https://discourse.julialang.org/u/xxxxx)\
**Replies:** 5\
**Last updated:** [December 4, 2023, 8:01pm UTC](https://discourse.julialang.org/t/nesting-the-glm-jl-in-the-objective-function-when-formulating-the-reversediff-gradient-generates-stackoverflowerror/107050 "2023-12-04T20:01:54Z")

</div>

Hi, in formulating my objective function for optimization, in one of the steps, the parameters will enter a Poisson regression as the weight, which I implemented through GLM.jl package. However, when generating the gradi…

---

## [Binary latent variable for occupancy modelling using Turing](https://discourse.julialang.org/t/binary-latent-variable-for-occupancy-modelling-using-turing/106090)

<div class="topic-metadata">

**Author:** [@VLucet](https://discourse.julialang.org/u/VLucet)\
**Replies:** 4\
**Last updated:** [December 1, 2023, 10:08pm UTC](https://discourse.julialang.org/t/binary-latent-variable-for-occupancy-modelling-using-turing/106090 "2023-12-01T22:08:45Z")

</div>

I am trying to implement a simple species occupancy model, which makes use of a latent binary variable. I’ve tried to get inspiration from this repository, but got confused by the approach and tried to start from even si…

---

## [VARMA and VARMAX time series models](https://discourse.julialang.org/t/varma-and-varmax-time-series-models/107003)

<div class="topic-metadata">

**Author:** [@Helectus](https://discourse.julialang.org/u/Helectus)\
**Replies:** 1\
**Last updated:** [December 1, 2023, 4:53pm UTC](https://discourse.julialang.org/t/varma-and-varmax-time-series-models/107003 "2023-12-01T16:53:03Z")

</div>

Is there a VARMA or VARMAX model in any package? Would it be worth it for me to develop a wrapper for pythons implementations? Maybe it has been done before and i cant find it?

---

## [Static array with uniform distribution](https://discourse.julialang.org/t/static-array-with-uniform-distribution/106961)

<div class="topic-metadata">

**Author:** [@sand](https://discourse.julialang.org/u/sand)\
**Replies:** 2\
**Last updated:** [November 30, 2023, 8:11pm UTC](https://discourse.julialang.org/t/static-array-with-uniform-distribution/106961 "2023-11-30T20:11:50Z")

</div>

Hello, I would like to know how to generate a static array with a uniform distribution (-2, 2). Here is an example: using StaticArrays using Distributions @SVector(randn(5)) # works rand(Uniform(-2, 2), 5) # w…

[Previous page](https://discourse.julialang.org/c/domain/stats/12.md?page=2)

[Next page](https://discourse.julialang.org/c/domain/stats/12.md?page=4)
