# Statistics

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

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

**Page:** 21

---

## [Constant/degenerate distribution](https://discourse.julialang.org/t/constant-degenerate-distribution/23817)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [May 3, 2019, 3:50pm UTC](https://discourse.julialang.org/t/constant-degenerate-distribution/23817 "2019-05-03T15:50:48Z")

</div>

Does any Julia package define a specific type for a constant/degenerate distribution, ie a given value with probability 1? I know I can use a Distributions.Categorical with just one value, the question is about having a…

---

## [Problem to import SPSS/SAS Data](https://discourse.julialang.org/t/problem-to-import-spss-sas-data/23728)

<div class="topic-metadata">

**Author:** [@Alessandro\_Vivas](https://discourse.julialang.org/u/Alessandro_Vivas)\
**Replies:** 3\
**Last updated:** [May 1, 2019, 12:05pm UTC](https://discourse.julialang.org/t/problem-to-import-spss-sas-data/23728 "2019-05-01T12:05:48Z")

</div>

I’m working with SPSS data, but I’m not able to import data. When I import with ReadStat I am not able to convert data to DataFrame. And when I use StatFiles I’m having import error problems. What is the correct way to i…

---

## [StatsBase, sampling without "putting back"](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367)

<div class="topic-metadata">

**Author:** [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Replies:** 2\
**Last updated:** [April 21, 2019, 10:28am UTC](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367 "2019-04-21T10:28:39Z")

</div>

Hello, Using the StatsBase package, it is possible to take samples using various procedures. Seems to me, but only with “put back”. This means that the same sample is taken several times. Is there a parameter or a proc…

---

## [DataFrames: is it possible to group data horizontally (multilevel)?](https://discourse.julialang.org/t/dataframes-is-it-possible-to-group-data-horizontally-multilevel/23239)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 10\
**Last updated:** [April 17, 2019, 5:11pm UTC](https://discourse.julialang.org/t/dataframes-is-it-possible-to-group-data-horizontally-multilevel/23239 "2019-04-17T17:11:25Z")

</div>

Dear community, suppose we have a simple dataframe df = DataFrame(Cat1 = \["A", "A", "B", "B"\], Cat2 = \["C", "D", "C", "D"\], val1 = 1:4, val2 = 5:8) which looks like julia\> …

---

## [DataFrames: how to calculate conditional mean values in grouped dataframe?](https://discourse.julialang.org/t/dataframes-how-to-calculate-conditional-mean-values-in-grouped-dataframe/23194)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 6\
**Last updated:** [April 16, 2019, 2:23pm UTC](https://discourse.julialang.org/t/dataframes-how-to-calculate-conditional-mean-values-in-grouped-dataframe/23194 "2019-04-16T14:23:11Z")

</div>

Dear Community, I have a DataFrame df, which I group for instance like: foo = by(df, \[:param1, :param2\], :res =\> mean) Here, columns param1 and param2 store parameter values and column res stores result values. Foo sh…

---

## [Lora Package](https://discourse.julialang.org/t/lora-package/23072)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 7\
**Last updated:** [April 13, 2019, 8:31am UTC](https://discourse.julialang.org/t/lora-package/23072 "2019-04-13T08:31:57Z")

</div>

Hello, i decided to download Julia 1.1.0 and leave the 0.7 version and i wanted to add the Lora package but i couldn’t because it was restricted by julia compatibility requirements to versions, so i wanna know what is t…

---

## [Simple linear regression question](https://discourse.julialang.org/t/simple-linear-regression-question/22749)

<div class="topic-metadata">

**Author:** [@corwin](https://discourse.julialang.org/u/corwin)\
**Replies:** 3\
**Last updated:** [April 5, 2019, 8:56pm UTC](https://discourse.julialang.org/t/simple-linear-regression-question/22749 "2019-04-05T20:56:31Z")

</div>

Hello! I apologize for possibly a simple question. I’m new to Julia, and maybe I didn’t find something in the description of StatsModels and TimeSeries. I have DataFrame data2 with time (yyyy-mm-dd) and 2 column with d…

---

## [Using RCall](https://discourse.julialang.org/t/using-rcall/22714)

<div class="topic-metadata">

**Author:** [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Replies:** 7\
**Last updated:** [April 4, 2019, 11:37am UTC](https://discourse.julialang.org/t/using-rcall/22714 "2019-04-04T11:37:58Z")

</div>

Hello, I’m still trying to solve my PCA problem, so I’m trying to use R over RCall. The package can be installed, but after using RCall, R reports up, but gets stuck! That is, nothing happens more…! The behavior applies…

---

## [PCA not working](https://discourse.julialang.org/t/pca-not-working/22645)

<div class="topic-metadata">

**Author:** [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Replies:** 13\
**Last updated:** [April 3, 2019, 8:38am UTC](https://discourse.julialang.org/t/pca-not-working/22645 "2019-04-03T08:38:34Z")

</div>

Hello, I’m working on the PCA from the MultivariateStats package and get the following error message (I’m working with ATOM): julia\> PCA\_Modell = fit(PCA, PCA\_Daten) ERROR: MethodError: no method matching fit(::Type{PC…

---

## [Is there a better DSL (domain-specific language) for defining a formula in linear models?](https://discourse.julialang.org/t/is-there-a-better-dsl-domain-specific-language-for-defining-a-formula-in-linear-models/22555)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [April 1, 2019, 9:22am UTC](https://discourse.julialang.org/t/is-there-a-better-dsl-domain-specific-language-for-defining-a-formula-in-linear-models/22555 "2019-04-01T09:22:17Z")

</div>

I have been an R user and I can see where StatsModel’s @formula macro came from - R! @formula(x ~ y - 1) where the -1 is to fit without an intercept was unintuitive to me, and also a\*b is the same as a + b + a&b i.e. in…

---

## [SAS/SPSS Mixed Model cov type translation to Julia (MixedModels.jl)](https://discourse.julialang.org/t/sas-spss-mixed-model-cov-type-translation-to-julia-mixedmodels-jl/22258)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 1\
**Last updated:** [March 28, 2019, 4:42pm UTC](https://discourse.julialang.org/t/sas-spss-mixed-model-cov-type-translation-to-julia-mixedmodels-jl/22258 "2019-03-28T16:42:06Z")

</div>

I try to use MixedModels.jl. Is any documentation how to translate SAS/SPSS random/repeated covariance type to julia MixedModels.jl notation? for example: RANDOM Fact1/TYPE=FA0(2) SUB=Fact2 G; REPEATED/GRP=Fact1 SUB=…

---

## [User-defined distribution function example](https://discourse.julialang.org/t/user-defined-distribution-function-example/22035)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 14\
**Last updated:** [March 21, 2019, 12:28pm UTC](https://discourse.julialang.org/t/user-defined-distribution-function-example/22035 "2019-03-21T12:28:30Z")

</div>

I am new to Julia, and I want to define my own distribution function. I found this post and followed the documentation, but I did not understand where do I put in the actual function (namely f(x)) of the distribution. Ca…

---

## [Any synthetic control libraries in julia?](https://discourse.julialang.org/t/any-synthetic-control-libraries-in-julia/21272)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 4\
**Last updated:** [March 18, 2019, 10:57pm UTC](https://discourse.julialang.org/t/any-synthetic-control-libraries-in-julia/21272 "2019-03-18T22:57:03Z")

</div>

Is anyone doing anything related to synthetic controls in julia? Like the Synth package for R and Stata? It would be great to see some of the implementations and work done in that space.

---

## [calculate p(D|M) for Turing tutorial model?](https://discourse.julialang.org/t/calculate-p-d-m-for-turing-tutorial-model/21985)

<div class="topic-metadata">

**Author:** [@subunit](https://discourse.julialang.org/u/subunit)\
**Replies:** 0\
**Last updated:** [March 18, 2019, 2:31am UTC](https://discourse.julialang.org/t/calculate-p-d-m-for-turing-tutorial-model/21985 "2019-03-18T02:31:13Z")

</div>

Hi folks, I am new to Julia, Turing, and Bayes, so I’m a bit out of my depth here. I think I have a rough handle on what Turing is doing in the third tutorial (http://turing.ml/tutorials/3-bayesnn/), which is close to m…

---

## [How can we extract the individual random slopes from a MixedModel.jl fit?](https://discourse.julialang.org/t/how-can-we-extract-the-individual-random-slopes-from-a-mixedmodel-jl-fit/21780)

<div class="topic-metadata">

**Author:** [@arnaudmgh](https://discourse.julialang.org/u/arnaudmgh)\
**Replies:** 2\
**Last updated:** [March 12, 2019, 5:36pm UTC](https://discourse.julialang.org/t/how-can-we-extract-the-individual-random-slopes-from-a-mixedmodel-jl-fit/21780 "2019-03-12T17:36:46Z")

</div>

In R package lme4, the function coef seems to return slopes for each level of the factor, but in Julia coef returns only fixed effects. (see r - Extracting slopes for cases from a mixed effects model (lme4) - Cross Valid…

---

## [Confidence Interval for certain Contrast and model residual](https://discourse.julialang.org/t/confidence-interval-for-certain-contrast-and-model-residual/20339)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 13\
**Last updated:** [February 20, 2019, 6:13pm UTC](https://discourse.julialang.org/t/confidence-interval-for-certain-contrast-and-model-residual/20339 "2019-02-20T18:13:44Z")

</div>

I have a model like this: ols = lm(@formula(LnVar ~ Seq+Per+Trt+Subj), df) I try to get confidence interval for Trt contrast, LSM and model residual. How to obtain it? In R you just do confint(lmobj, c("Trt"), level=…

---

## [GLM.jl with unknown column names](https://discourse.julialang.org/t/glm-jl-with-unknown-column-names/20692)

<div class="topic-metadata">

**Author:** [@george](https://discourse.julialang.org/u/george)\
**Replies:** 4\
**Last updated:** [February 19, 2019, 5:47pm UTC](https://discourse.julialang.org/t/glm-jl-with-unknown-column-names/20692 "2019-02-19T17:47:29Z")

</div>

Hello, I’m using Julia for some basic statistical analysis. I’d like to run a simple linear regression on a small dataset using the GLM.jl package. My data looks something like this: │ Row │ stat.id12312.somemetadata …

---

## [Median vs 50th Quantile giving different answers](https://discourse.julialang.org/t/median-vs-50th-quantile-giving-different-answers/18414)

<div class="topic-metadata">

**Author:** [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)\
**Replies:** 6\
**Last updated:** [February 18, 2019, 1:22pm UTC](https://discourse.julialang.org/t/median-vs-50th-quantile-giving-different-answers/18414 "2019-02-18T13:22:09Z")

</div>

I’m getting different answers for median(v,w::AnalyticWeights) and quantile(v,w::AnalyticWeights,0.5) and not sure why. Any ideas?

---

## [Applying \`quantile\` to \`AbstractArray\`s](https://discourse.julialang.org/t/applying-quantile-to-abstractarray-s/20619)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 1\
**Last updated:** [February 10, 2019, 12:11am UTC](https://discourse.julialang.org/t/applying-quantile-to-abstractarray-s/20619 "2019-02-10T00:11:35Z")

</div>

The docstring of quantile in the Statistics module says: quantile(itr, p; sorted=false) Compute the quantile(s) of a collection itr at a specified probability or vector or tuple of probabilities p on the interval \[0,…

---

## [How to fit a GLM to all (unnamed) features of arbitrary design matrix?](https://discourse.julialang.org/t/how-to-fit-a-glm-to-all-unnamed-features-of-arbitrary-design-matrix/20490)

<div class="topic-metadata">

**Author:** [@murphyk](https://discourse.julialang.org/u/murphyk)\
**Replies:** 2\
**Last updated:** [February 6, 2019, 9:18pm UTC](https://discourse.julialang.org/t/how-to-fit-a-glm-to-all-unnamed-features-of-arbitrary-design-matrix/20490 "2019-02-06T21:18:13Z")

</div>

I want to call the GLM.jl library as a blackbox, which means I want to use a formula of the form “y ~ .”, where y is the target column of my dataframe, and . is all the other features. Specifically, what I would like to…

---

## [Linear regression with a positive definite matrix in GLM.jl?](https://discourse.julialang.org/t/linear-regression-with-a-positive-definite-matrix-in-glm-jl/14638)

<div class="topic-metadata">

**Author:** [@sebastianskejoe](https://discourse.julialang.org/u/sebastianskejoe)\
**Replies:** 11\
**Last updated:** [February 1, 2019, 7:37pm UTC](https://discourse.julialang.org/t/linear-regression-with-a-positive-definite-matrix-in-glm-jl/14638 "2019-02-01T19:37:47Z")

</div>

Hi I’m trying to perform linear regression on a small dataset (these are just sample data, the real dataset will be much larger), but I’m running into a problem with the matrix not being positive definite, which it very…

---

## [About the convention for the design matrix (row-as-observation or column-as-observation)](https://discourse.julialang.org/t/about-the-convention-for-the-design-matrix-row-as-observation-or-column-as-observation/20080)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 3\
**Last updated:** [January 25, 2019, 12:26pm UTC](https://discourse.julialang.org/t/about-the-convention-for-the-design-matrix-row-as-observation-or-column-as-observation/20080 "2019-01-25T12:26:43Z")

</div>

At the risk of resucitating an old discussion… I was exploring some of the code in JuliaStats and Clustering and realised that a convention often used in these packages (and in similar ones like GaussianProcesses) is th…

---

## [How to fit MixedModels with the option REML=TRUE?](https://discourse.julialang.org/t/how-to-fit-mixedmodels-with-the-option-reml-true/19746)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 5\
**Last updated:** [January 25, 2019, 7:20am UTC](https://discourse.julialang.org/t/how-to-fit-mixedmodels-with-the-option-reml-true/19746 "2019-01-25T07:20:37Z")

</div>

I need to use the package MixedModels.jl for regression with random effects. I’ve created the following toy example. using DataFrames, MixedModels, StatsBase, Distributions, LinearAlgebra, SparseArrays N=50 x1 = rep…

---

## [Studentized Range Distribution?](https://discourse.julialang.org/t/studentized-range-distribution/20050)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 3\
**Last updated:** [January 24, 2019, 9:56pm UTC](https://discourse.julialang.org/t/studentized-range-distribution/20050 "2019-01-24T21:56:14Z")

</div>

I may be missing it, but does Distributions.jl contain the q (Studentized range) distribution? This is the one used for post-hoc multiple comparisons. Defined by degrees of freedom (nu) and number of comparisons (k).

---

## [Using GLM.jl for mixed design Anova](https://discourse.julialang.org/t/using-glm-jl-for-mixed-design-anova/19922)

<div class="topic-metadata">

**Author:** [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Replies:** 4\
**Last updated:** [January 22, 2019, 9:58pm UTC](https://discourse.julialang.org/t/using-glm-jl-for-mixed-design-anova/19922 "2019-01-22T21:58:29Z")

</div>

Is it possible to get with GLM.jl and ANOVA.jl something equivalent to R’s aov(data ~ age\*day + Error(id/day), data = data) to study data with one between (age) and one within (day) factor? I am stuck with translating…

---

## [Working with posteriors](https://discourse.julialang.org/t/working-with-posteriors/19846)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [January 22, 2019, 10:45am UTC](https://discourse.julialang.org/t/working-with-posteriors/19846 "2019-01-22T10:45:13Z")

</div>

Finding that I am writing a lot of repetitive code, I am trying to rethink the way I work with posterior distributions (eg from MCMC). I can typically reduce most operations on posteriors to transformations, which opera…

---

## [A uniform way to generate a random element based on a given probability distritution function, a random number genarator and a given element interval?](https://discourse.julialang.org/t/a-uniform-way-to-generate-a-random-element-based-on-a-given-probability-distritution-function-a-random-number-genarator-and-a-given-element-interval/19843)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [January 20, 2019, 3:18pm UTC](https://discourse.julialang.org/t/a-uniform-way-to-generate-a-random-element-based-on-a-given-probability-distritution-function-a-random-number-genarator-and-a-given-element-interval/19843 "2019-01-20T15:18:17Z")

</div>

Dispatching is one of Julia’s strong suits. I was wondering, is there a single function which would generate a random element based on a given probability distribution function, a random number genarator and a given ele…

---

## [Different syntax for MixedModels? What's the difference?](https://discourse.julialang.org/t/different-syntax-for-mixedmodels-whats-the-difference/19754)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 2\
**Last updated:** [January 19, 2019, 11:07am UTC](https://discourse.julialang.org/t/different-syntax-for-mixedmodels-whats-the-difference/19754 "2019-01-19T11:07:22Z")

</div>

Hello. I would like to use MixedModels.jl to fit regression models with random effects. Looking at the official docs and some examples on the Internet I’ve found different syntaxes. For example if I want to fit a Logi…

---

## [When to use SVD and when to use Eigendecomposition for PCA?](https://discourse.julialang.org/t/when-to-use-svd-and-when-to-use-eigendecomposition-for-pca/19689)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 5\
**Last updated:** [January 16, 2019, 2:14pm UTC](https://discourse.julialang.org/t/when-to-use-svd-and-when-to-use-eigendecomposition-for-pca/19689 "2019-01-16T14:14:07Z")

</div>

As a long time R user I was always under the impression that SVD is superior to and eigenvalue decomposition of the correlation matrix (see the documentation for prcomp and princomp) in terms of numerical accuracy and co…

---

## ["Fancy" matrix variable transformations in TransformVariables.jl / DynamicHMC.jl](https://discourse.julialang.org/t/fancy-matrix-variable-transformations-in-transformvariables-jl-dynamichmc-jl/19618)

<div class="topic-metadata">

**Author:** [@hessammehr](https://discourse.julialang.org/u/hessammehr)\
**Replies:** 2\
**Last updated:** [January 14, 2019, 1:22pm UTC](https://discourse.julialang.org/t/fancy-matrix-variable-transformations-in-transformvariables-jl-dynamichmc-jl/19618 "2019-01-14T13:22:32Z")

</div>

Lately I’ve been using @Tamas\_Papp’s excellent DynamicHMC package (thank you, Tamas!) and it’s been a lot of fun, but was hoping someone could point me in the right direction with a few more esoteric variable transformat…

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

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