# Statistics

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

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

**Page:** 18

---

## [Pkg add Distributions fails with Unable to automatically install 'Rmath'](https://discourse.julialang.org/t/pkg-add-distributions-fails-with-unable-to-automatically-install-rmath/37047)

<div class="topic-metadata">

**Author:** [@jaynick](https://discourse.julialang.org/u/jaynick)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 12:57pm UTC](https://discourse.julialang.org/t/pkg-add-distributions-fails-with-unable-to-automatically-install-rmath/37047 "2020-04-07T12:57:45Z")

</div>

This is on Julia1.3.1, Mac 10.14.5 Activating environment at \`~/myuser/...Project.toml\` \[587475ba\] Flux v0.10.3 \[e88e6eb3\] Zygote v0.4.10 julia\> Pkg.add("Distributions") Updating registry at \`~/.julia/registries/G…

---

## [Bug in var() when supplying means as vectors](https://discourse.julialang.org/t/bug-in-var-when-supplying-means-as-vectors/36979)

<div class="topic-metadata">

**Author:** [@gabehassler](https://discourse.julialang.org/u/gabehassler)\
**Replies:** 4\
**Last updated:** [April 5, 2020, 4:36pm UTC](https://discourse.julialang.org/t/bug-in-var-when-supplying-means-as-vectors/36979 "2020-04-05T16:36:32Z")

</div>

I’m trying to standardize (subtract the mean and divide by the standard deviation) of each column in a matrix. In doing so, I think I’v discovered a bug in the var() function when supplying the means. The following code…

---

## [Sampling from a normal distribution](https://discourse.julialang.org/t/sampling-from-a-normal-distribution/36848)

<div class="topic-metadata">

**Author:** [@samantp](https://discourse.julialang.org/u/samantp)\
**Replies:** 4\
**Last updated:** [April 1, 2020, 4:28pm UTC](https://discourse.julialang.org/t/sampling-from-a-normal-distribution/36848 "2020-04-01T16:28:11Z")

</div>

I am trying to draw 1000 random values from a normal distribution with a specific mean and standard deviation. Additionally, the values cannot be negative, which is an added constraint. To do this I have been trying to u…

---

## [Spearman Correlation, How do I find rho?](https://discourse.julialang.org/t/spearman-correlation-how-do-i-find-rho/36291)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 17\
**Last updated:** [March 27, 2020, 8:26am UTC](https://discourse.julialang.org/t/spearman-correlation-how-do-i-find-rho/36291 "2020-03-27T08:26:57Z")

</div>

B= df.Crude\_Birth\_Rate Employment\_df = DataFrame(A=df.Female\_Employment,B=df.Crude\_Birth\_Rate, )corspearman(x=A, y=B) = cor(tiedrank(A), tiedrank(B)) I’m trying to do a Spearman Correlation Test, because I know from my…

---

## [How to do Cross Tabs?](https://discourse.julialang.org/t/how-to-do-cross-tabs/36533)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 4\
**Last updated:** [March 26, 2020, 10:11pm UTC](https://discourse.julialang.org/t/how-to-do-cross-tabs/36533 "2020-03-26T22:11:19Z")

</div>

Is there a package to do Cross Tabulation? I have HypothesisTests and StatsBase, but can’t find anything about Cross Tabulation in the documentation for each.

---

## [Multivariate Correlation Tables-- Partial Correlation Tables](https://discourse.julialang.org/t/multivariate-correlation-tables-partial-correlation-tables/36566)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 0\
**Last updated:** [March 26, 2020, 8:03pm UTC](https://discourse.julialang.org/t/multivariate-correlation-tables-partial-correlation-tables/36566 "2020-03-26T20:03:23Z")

</div>

In there a way to automatically generarate partial correlation tables?

---

## [How do I add arguments to a frequency table?](https://discourse.julialang.org/t/how-do-i-add-arguments-to-a-frequency-table/36517)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 14\
**Last updated:** [March 26, 2020, 5:04pm UTC](https://discourse.julialang.org/t/how-do-i-add-arguments-to-a-frequency-table/36517 "2020-03-26T17:04:34Z")

</div>

I’m trying to do a frequency table with a data frame ‘df’ frequencytable(df) I get an error, argument not provided. What arguments do I need?

---

## [Correlation Matrix vs Contingency Table](https://discourse.julialang.org/t/correlation-matrix-vs-contingency-table/36522)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 4\
**Last updated:** [March 26, 2020, 1:06am UTC](https://discourse.julialang.org/t/correlation-matrix-vs-contingency-table/36522 "2020-03-26T01:06:55Z")

</div>

Is there a difference between a correlation table and a contingency matrix?

---

## [Simulation of super high-dimensional distribution](https://discourse.julialang.org/t/simulation-of-super-high-dimensional-distribution/35144)

<div class="topic-metadata">

**Author:** [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Replies:** 3\
**Last updated:** [March 24, 2020, 2:26am UTC](https://discourse.julialang.org/t/simulation-of-super-high-dimensional-distribution/35144 "2020-03-24T02:26:16Z")

</div>

I am working on simulated method of moments which requires to draw random variables from a multivariate normal distribution for numerical integration. However, the dimension of this multivariate normal distribution is su…

---

## [Understanding Linear Regression and finding R-Squared](https://discourse.julialang.org/t/understanding-linear-regression-and-finding-r-squared/36079)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 11\
**Last updated:** [March 24, 2020, 12:15am UTC](https://discourse.julialang.org/t/understanding-linear-regression-and-finding-r-squared/36079 "2020-03-24T00:15:05Z")

</div>

I entered this dataframe and the GLM function below: DEmployment = \[0.036327933,0.034107058,0.030691709,0.029333333,-0.008635579,0.010452962,0.017672414,0.024565862,0.030177759,0.01565008,0.02094034,0.011609907,0.008416…

---

## [Can't seem to get reverse\_diff working in Turing](https://discourse.julialang.org/t/cant-seem-to-get-reverse-diff-working-in-turing/36015)

<div class="topic-metadata">

**Author:** [@HarrisonWilde](https://discourse.julialang.org/u/HarrisonWilde)\
**Replies:** 10\
**Last updated:** [March 15, 2020, 9:19pm UTC](https://discourse.julialang.org/t/cant-seem-to-get-reverse-diff-working-in-turing/36015 "2020-03-15T21:19:41Z")

</div>

I am having some issues with getting my code to work with reverse\_diff enabled, which I believe would be a good idea due to having around 35 params, I get the following error: ERROR: MethodError: no method matching zero…

---

## [Help understanding GLM (the concept, not the package)](https://discourse.julialang.org/t/help-understanding-glm-the-concept-not-the-package/35896)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [March 13, 2020, 3:56pm UTC](https://discourse.julialang.org/t/help-understanding-glm-the-concept-not-the-package/35896 "2020-03-13T15:56:23Z")

</div>

I’m trying to understand how generalized linear models work by coding a simple example from scratch and I’m hoping some of the stats experts here (I know there are several of you lurking around :face\_with\_monocle:) can h…

---

## [Speeding up MCMC for logistic regression with large datasets using Turing or some alternative](https://discourse.julialang.org/t/speeding-up-mcmc-for-logistic-regression-with-large-datasets-using-turing-or-some-alternative/35838)

<div class="topic-metadata">

**Author:** [@HarrisonWilde](https://discourse.julialang.org/u/HarrisonWilde)\
**Replies:** 2\
**Last updated:** [March 12, 2020, 5:58pm UTC](https://discourse.julialang.org/t/speeding-up-mcmc-for-logistic-regression-with-large-datasets-using-turing-or-some-alternative/35838 "2020-03-12T17:58:19Z")

</div>

Hi, I am running some logistic regression MCMC sampling chains using Turing and wondering how best to optimise / use multiprocessing etc. to get maximum performance. My code currently looks like this: function get\_condi…

---

## [Question on Bayesian Inference with Julia, using Turing and/or AdvancedHMC and/or Distributions](https://discourse.julialang.org/t/question-on-bayesian-inference-with-julia-using-turing-and-or-advancedhmc-and-or-distributions/35776)

<div class="topic-metadata">

**Author:** [@HarrisonWilde](https://discourse.julialang.org/u/HarrisonWilde)\
**Replies:** 11\
**Last updated:** [March 11, 2020, 11:55am UTC](https://discourse.julialang.org/t/question-on-bayesian-inference-with-julia-using-turing-and-or-advancedhmc-and-or-distributions/35776 "2020-03-11T11:55:25Z")

</div>

I am looking to run some experiments in Julia after growing tired of jumping in and out of Stan and suffering from some performance issues that I think Julia could help eliminate. I am looking to do MCMC to learn paramet…

---

## [Predicting discrete events == expenses](https://discourse.julialang.org/t/predicting-discrete-events-expenses/35612)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 12\
**Last updated:** [March 6, 2020, 4:02pm UTC](https://discourse.julialang.org/t/predicting-discrete-events-expenses/35612 "2020-03-06T16:02:48Z")

</div>

This question is 50% not about Julia. When I try to predict how much money I will spend in the future, I sum expenses per month for multiple months and base my stats on that set of monthly expenses. But, it feels like I…

---

## [Wrapping tests involving eval in @testset](https://discourse.julialang.org/t/wrapping-tests-involving-eval-in-testset/35257)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 2\
**Last updated:** [March 6, 2020, 12:12am UTC](https://discourse.julialang.org/t/wrapping-tests-involving-eval-in-testset/35257 "2020-03-06T00:12:45Z")

</div>

I often get into trouble wrapping unit tests involving macros or eval in @testset. Can someone explain why the first example works but the second fails? x = 5 eval(quote @test x == 5 end …

---

## [Mean of integers overflows - bug or expected behaviour?](https://discourse.julialang.org/t/mean-of-integers-overflows-bug-or-expected-behaviour/34767)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 94\
**Last updated:** [March 3, 2020, 2:44am UTC](https://discourse.julialang.org/t/mean-of-integers-overflows-bug-or-expected-behaviour/34767 "2020-03-03T02:44:51Z")

</div>

The function mean(), when used on Int inputs, returns a float result. However, it may silently overflow on integer arithmetic. julia\> mean(\[1,1\]\*typemax(Int)) -1 Maintainer of Statistics.jl closed the issue, saying t…

---

## [Printing Frequency Tables as Tables](https://discourse.julialang.org/t/printing-frequency-tables-as-tables/35333)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 3\
**Last updated:** [February 29, 2020, 9:39pm UTC](https://discourse.julialang.org/t/printing-frequency-tables-as-tables/35333 "2020-02-29T21:39:08Z")

</div>

I’m trying to print out Frequency Tables of Data I have out = DataFrame(Q1 = \[3,3,3\], Q2 = \[3,2,1\]) when I run this line or type julia\> AllOut) I get a table like this. Dim1 ╲ Dim2 │ 1 2 3 ────────────┼──────── 1 …

---

## [Entering xlsx columns into HypothosisTests](https://discourse.julialang.org/t/entering-xlsx-columns-into-hypothosistests/35157)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 26\
**Last updated:** [February 27, 2020, 10:55pm UTC](https://discourse.julialang.org/t/entering-xlsx-columns-into-hypothosistests/35157 "2020-02-27T22:55:59Z")

</div>

I’m trying to do Chi Squared tests of variables in a dataframe, from an xlsx file. When I use describe() I get a table: ────┼─────────┼──────────┼──────────┤ │ 1 │ Q1 │ 1.47727 │ 1 │ 1.0 │ 2 │ 2 …

---

## [Faster Bernoulli sampling](https://discourse.julialang.org/t/faster-bernoulli-sampling/35209)

<div class="topic-metadata">

**Author:** [@Adriel](https://discourse.julialang.org/u/Adriel)\
**Replies:** 7\
**Last updated:** [February 27, 2020, 9:31pm UTC](https://discourse.julialang.org/t/faster-bernoulli-sampling/35209 "2020-02-27T21:31:48Z")

</div>

I have a need for huge numbers of Bernoulli samples, so I tried to do better than the simple implementation in Distributions.jl (which just does rand() \< p), using a binary arithmetic decoder. Some timing results. juli…

---

## [How to read in a list of integers into an array](https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185)

<div class="topic-metadata">

**Author:** [@lesshaste](https://discourse.julialang.org/u/lesshaste)\
**Replies:** 16\
**Last updated:** [February 27, 2020, 10:24am UTC](https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185 "2020-02-27T10:24:19Z")

</div>

I have been a number of files, each contains one list of integers. I would just like to read in the contents into an array in Julia. Here is an example file: http://paste.ubuntu.com/p/pxmwPXkNNk/ How can I do that? I…

---

## [Example Chi Square test - why different answers from HypothesisTests and Distances?](https://discourse.julialang.org/t/example-chi-square-test-why-different-answers-from-hypothesistests-and-distances/13392)

<div class="topic-metadata">

**Author:** [@robblackwell](https://discourse.julialang.org/u/robblackwell)\
**Replies:** 6\
**Last updated:** [February 26, 2020, 1:43pm UTC](https://discourse.julialang.org/t/example-chi-square-test-why-different-answers-from-hypothesistests-and-distances/13392 "2020-02-26T13:43:32Z")

</div>

I’m trying to reproduce an example Chi square test given in in the text book, Practical Statistics for Field Biology which compares the histogram of some numbers (O) with expected values (E). The worked example gives 5.2…

---

## [Aggregated Binary Data in MixedModels](https://discourse.julialang.org/t/aggregated-binary-data-in-mixedmodels/34919)

<div class="topic-metadata">

**Author:** [@talat](https://discourse.julialang.org/u/talat)\
**Replies:** 1\
**Last updated:** [February 21, 2020, 9:03am UTC](https://discourse.julialang.org/t/aggregated-binary-data-in-mixedmodels/34919 "2020-02-21T09:03:29Z")

</div>

Hello all, I’m trying to fit a generalized linear mixed model using the MixedModels package. It works fine as long as I use “normal” binary data i.e. response vector is simply 0/1 and each observartion is one row. I wou…

---

## [Package for Confidence Intervals?](https://discourse.julialang.org/t/package-for-confidence-intervals/33902)

<div class="topic-metadata">

**Author:** [@Usor](https://discourse.julialang.org/u/Usor)\
**Replies:** 19\
**Last updated:** [February 16, 2020, 10:42pm UTC](https://discourse.julialang.org/t/package-for-confidence-intervals/33902 "2020-02-16T22:42:02Z")

</div>

Is there a package dealing with these kinds of computations, or should I make my own functions for my purposes?

---

## [Possible reasons that MixedModels would not create the property "sigmas"?](https://discourse.julialang.org/t/possible-reasons-that-mixedmodels-would-not-create-the-property-sigmas/34073)

<div class="topic-metadata">

**Author:** [@kai](https://discourse.julialang.org/u/kai)\
**Replies:** 4\
**Last updated:** [February 16, 2020, 10:11pm UTC](https://discourse.julialang.org/t/possible-reasons-that-mixedmodels-would-not-create-the-property-sigmas/34073 "2020-02-16T22:11:53Z")

</div>

I want to fit a linear mixed model inside my function and extract estimates of random effect standard deviations (sigmas from a LinearMixedModel object). So I wrote the following function, and it runs perfectly in REPL …

---

## [Is Distributions.jl currently accepting PRs for new distributions?](https://discourse.julialang.org/t/is-distributions-jl-currently-accepting-prs-for-new-distributions/34078)

<div class="topic-metadata">

**Author:** [@johnczito](https://discourse.julialang.org/u/johnczito)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 10:53pm UTC](https://discourse.julialang.org/t/is-distributions-jl-currently-accepting-prs-for-new-distributions/34078 "2020-02-15T22:53:22Z")

</div>

What is the current “policy” regarding merging new distributions into Distributions.jl? It would appear that the last time someone tried https://github.com/JuliaStats/Distributions.jl/pull/972 they got partially tied …

---

## [StatsBase.jl sample size \> 31 throws error](https://discourse.julialang.org/t/statsbase-jl-sample-size-31-throws-error/34484)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 3\
**Last updated:** [February 12, 2020, 12:52pm UTC](https://discourse.julialang.org/t/statsbase-jl-sample-size-31-throws-error/34484 "2020-02-12T12:52:16Z")

</div>

I’m running into an issue that I’m hoping someone can help me understand. I have a 1308 x 22 DataFrame that I’m trying to sample from with StatsBase. All is well and fine as long as n \<= 31. The code looks like this: j…

---

## [Fitting a circle/ellipse over an image](https://discourse.julialang.org/t/fitting-a-circle-ellipse-over-an-image/34143)

<div class="topic-metadata">

**Author:** [@razvangheorghe](https://discourse.julialang.org/u/razvangheorghe)\
**Replies:** 15\
**Last updated:** [February 11, 2020, 7:48pm UTC](https://discourse.julialang.org/t/fitting-a-circle-ellipse-over-an-image/34143 "2020-02-11T19:48:03Z")

</div>

Hello, It would be very useful if I could fit a circle/ellipse over a set of density plots. The images are very noisy, but for most of them, you can vaguely make up the shape of an ellipse. Here’s an example: What …

---

## [Sample conditional multivariate random variable?](https://discourse.julialang.org/t/sample-conditional-multivariate-random-variable/34035)

<div class="topic-metadata">

**Author:** [@Alex1](https://discourse.julialang.org/u/Alex1)\
**Replies:** 4\
**Last updated:** [January 31, 2020, 10:40pm UTC](https://discourse.julialang.org/t/sample-conditional-multivariate-random-variable/34035 "2020-01-31T22:40:03Z")

</div>

There’s multivariate random variable, future prices of assets, 5 years from now: X = \[Gold, Silver, SP500\] There’s historical prices for X available for last 50 years. It’s possible to fit historical prices to get mult…

---

## [Convert between z critical values and confidence levels?](https://discourse.julialang.org/t/convert-between-z-critical-values-and-confidence-levels/33904)

<div class="topic-metadata">

**Author:** [@Usor](https://discourse.julialang.org/u/Usor)\
**Replies:** 1\
**Last updated:** [January 29, 2020, 5:23am UTC](https://discourse.julialang.org/t/convert-between-z-critical-values-and-confidence-levels/33904 "2020-01-29T05:23:57Z")

</div>

Are there readily available functions to immediately convert between these two?

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

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