The Stack Overflow podcast is back! Listen to an interview with our new CEO.

All Questions

Filter by
Sorted by
Tagged with
11
votes
1answer
447 views

How can I reproduce the result of PrincipalComponents

...
11
votes
1answer
2k views

How to interpret the results of PCA

There is a larger matrix (1500 rows x 40 columns), 1500 observations x 40 variables. then I follow the procedures of PCA(Principal components analysis), 1. find correlation 2. find eigenvalues 3. ...
6
votes
3answers
10k views

How to use a 3×3 covariance matrix to plot an error ellipsoid?

I have a 3×3 error covariance in Mathematica, but I don't know how to use it for plotting the error ellipsoid. It would be great if you can show me how I can do that for the below covariance matrix: <...
4
votes
2answers
132 views

Sample matrix indices in proportion to the matrix element values

I have a 4 by 4 array which has a probability associated with each point. {{0., 0., 0., 0.9}, {0., 0.05, 0., 0.}, {0., 0., 0., 0.}, {0., 0., 0.05, 0.}} I ...
4
votes
1answer
471 views

Calculate the covariance of a large matrix

I have to compute the covariance of 50 very large integer matrices (2500x2000 elements). However, according to my estimation this will take around 10 days. Do you have any ideas how to speed things up?...
4
votes
1answer
766 views

What is the Mathematica equivalent for corr2?

What is the Mathematica equivalent for MATLAB's corr2, which gives the correlation coefficient of two 2D matrices?
4
votes
1answer
2k views

stationary distribution of a transition matrix

How can I solve the stationary distribution of a finite Markov Chain? In other words, how can I estimate the eigenvectors of a transition matrix?
4
votes
2answers
1k views

Total Variation Distance of probability matrix

How can I calculate the Total Variation Distance of a transition Matrix? is there any built in function? I've searched all documentation and haven;t found anything. ** More information: Let me try ...
3
votes
2answers
227 views

How to form binary matrix with constants and given probability?

I want to create a binary matrix of 6x3 in which six elements (m13,m23, m33, m42, m52, m61) are constant and assigned '0' value; whereas for other twelve elements (m11, m12, m21, m22, m31,m32, m41, ...
3
votes
0answers
254 views

Mathematica Complains about Non Symmetric Covariance matrix, when it's not the case

I was doing some fitting with Mathematica7 using NonlinearModelFit. It's quite long the program to do the fit and that's why I am not displaying here ... It goes ok, and I can get the fit parameters ...
2
votes
4answers
153 views

How to generate a matrix with certain conditions

I want to generate a $n \times n$ matrix. I want the diagonal entries to be all 0 I want a random choice of matrix elements with 0 or 1. The probability of having a 1 as a matrix element is $1/m$ and ...
2
votes
2answers
343 views

Measures of association, Concordant and Discordant

I want to calculate concordant and discordant pairs on nx2 tables. ...
2
votes
1answer
246 views

Creating a contingency table

I need help in creating a function for a contingency table... I imagined to create it like this... ...
2
votes
3answers
106 views

Find rank of the row nearest to random variable

I have following code dist[a_, b_] = WeibullDistribution[a, b]; data = Table[ j = Table[i = RandomVariate[dist[2, 1], {3, 3}], {i, 1, 4}], {j, 1, 3}] above ...
2
votes
1answer
86 views

Compute the potential of confusion between two matrices

I have a problem. Any help will be appreciated. In order to calculate the accuracy, sensitivity, sensibility and F1 score between diseases and their symptoms, I have two matrices with a different ...
2
votes
1answer
150 views

Can't define average for my matrix

I have a list defined as MarsDisk which, in MatrixForm, has 17 rows and 3 columns, which hold information about a photon energy ...
2
votes
1answer
414 views

Generate a simulated covariance matrix

I am working on a problem where one of the input variables is the level of covariance between the entries in a particular matrix. To simulate this problem in Mathematica, I will need to feed my code ...
2
votes
1answer
154 views

Extracting Imported Information

What I want to do is to compare the relationship between the consumption of say beer and wine using scatter plots where each point designates the particular country (preferably named). I have tried to ...
2
votes
0answers
42 views

Matrix of deviate scores

I am trying to replicate some steps in Jonathon D. Brown's text "Linear Models in Matrix Form: A Hands-On Approach for the Behavioral Sciences" Brown, 2014, p.12. I am creating a "matrix of deviate ...
1
vote
2answers
399 views

Generic Matrices

A multivariate Gaussian distribution for $k$ dimensions looks like this: $$\frac{1}{\sqrt{(2\pi)^k|\mathbf \Sigma|}}\mathbf e^{ -\frac 1 2 \mathbf x^T \mathbf \Sigma^{-1}\mathbf x }$$ $\mathbf x$ ...
1
vote
1answer
73 views

Computing the PDF of a WishartMatrixDistribution. Is this a limitation in the PDF Mathematica function?

I'm trying to compute the pdf of a wishart distribution. Why does PDF[WishartMatrixDistribution[10, IdentityMatrix[4]], 2*IdentityMatrix[4]] not return a ...
1
vote
2answers
148 views

Is this a Symmetric Matrix or not?

I've generated the cov matrix in the following way: ...
1
vote
0answers
61 views

Noise covariance matrix

I am trying to find the noise covariance matrix of a random vector $\mathbf{x}$ with itself. The elements of this vector represent image pixels and are treated as random variables i.e, $\mathbf{x}=\{...
1
vote
0answers
77 views

how to derive a conditional covariance matrix (symbolically)

I have searched the database of the questions asked in this forum but to my surprise I could not find any satisfactory answer to my relatively simple question. Given a vector of random variables <...
1
vote
0answers
98 views

Construct a univariate function pertaining to the space of $2 \times 2$ real matrices [closed]

Consider the space of uniformly distributed $2 \times 2$ real matrices \begin{equation} \left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right), \end{equation} with the restriction ...
1
vote
0answers
98 views

Sampling from an one-dimensional Wishart [closed]

I searched for a similar question but could not find one. My problem is sampling from an one-dimensional Wishart distribution. The Mathematica specification is ...
0
votes
2answers
184 views

How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
0
votes
2answers
107 views

Rewriting a given multivariate PDF so that it has the form of multivariate normal

Say, we are given a probability distribution function that we suspect is a multivariate normal. In Mathematica, how can we rewrite such PDF to get its covariance matrix and vector of means? For ...
0
votes
1answer
46 views

How to write a command that produces such a matrix that takes n as an argument, where every node has probability 1/m [closed]

Please help in answering the questions above on mathematica. Which commands do I use to answer the question?
0
votes
1answer
201 views

Discrete 3D plots of median ratios of two 2D matrices of lists of values

Lets say I have 2 2D arrays where each cell contains a list of values: Example: ...
0
votes
2answers
90 views

Calculating the probability of hitting, Fisher linear discriminant

I have 4 data matrix, which are described two parameters. (M1, M2, M3, M4). So I made transition from base parameters to principal components and displayed them in ...