Task at hand: generate a simulated dataset containing both continuous and categorical variables, given a pre-defined correlation matrix.   What has been done:  covers how to generate correlated continuous variables.  elaborates the generation of correlated categorical variables. Both quite comprehensible.   The question: it is unclear how to generate both continuous and categorical variables at the same time, all correlated between each other. For example, let's say we need to have a dataset with five variables, three continuous variables, and two categorical variables. The first categorical could refer to three income categories (therefore being ordinal), and the second one could be gender (therefore being nominal). The three continuous variables could be, say, scores on three psychological tests. All of them should be correlated to a given degree.   It would be possible to create a dataset with five correlated continuous variables, and then bin two of those into categorical, hopefully retaining some degree of the original relationship. Yet I am not sure how to control the degree of correlation in this case. The data simulation would be in R. Any ideas?   EDIT 1: To be clear, when it concerns categorical data, by correlation I mean statistical association, however it is measured (I have no preference there). Not the Pearson correlation.
I'm looking to generate a set of 5 random variables and enforce a dependence structure between them and onto a dependent variable $Y$.  I understand how to generate correlated random variables for multivariate normal, but not when mixing different types.  Below is a little more than I need, but I'm hoping someone can give me a general way of solving this problem...   $X_1$ and $X_2$ need to be highly correlated Bernoulli variables.  $X_3$ needs to take one of 5 categorical values, call them "A"..."E".  $X_4$ needs to be normal, and negatively correlated with $X_1$, $X_2$.  $X_5$ needs to approximate test scores from $0$ to $100$ with a high skew, so gamma probably.  $X_5$ needs to be positively correlated with $X_1$, $X_2$, $X_4$.   Each of these variables must impact a "success/occurrence" Bernoulli distributed variable $Y$.  How would I begin?  I would like to enforce correlation both between the values of $X$, and also between each $X$ and $Y$.  (The categorical correlations seem particularly confusing to me.)
Good tool for finding photo duplicates based on image data What is a good (and preferably free) tool for finding photo duplicates based on the photos themselves?  So, not filename, filesize etc., but how the photos look like. It would be nice if it managed to match photos that were the same image, but not exactly the same size for example too. Time-Stream Crossing and Forgetfulness In The Day of the Doctor, it's explained that the Doctor doesn't remember having interacted with himself, and if he interacts with a future version of himself, the younger version forgets.  But in Time Crash, 10th solves the problem of the TARDISes occupying the same space because he remembers himself doing it from when he was 5th.  If this is true, 5th wouldn't have wondered whether or not he was going to regenerate when he did.  Does the TARDIS occupying the same space with itself re-instate those memories? Or is it just possible that I'm asking a ridiculous question that will never have an answer because Doctor Who.  :D Numerical Approximation of Differential Equations with Midpoint Method Package Cache File corrupted From advice on  , I've opened a new question about the same issue, as it turned out my problem was not the one described in the question, information I did not know at the time. I'm running Ubuntu 16.04.  $ sudo apt-get update  Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB] Get:4 http://archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [307 kB] Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [226 kB] Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [185 kB] Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [268 kB] Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,888 B] Get:10 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B] Get:11 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [4,712 B] Get:12 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [62.7 kB] Get:13 http://archive.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [71.2 kB] Get:14 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [51.3 kB] Get:15 http://archive.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [85.1 kB] Fetched 1,578 kB in 1s (1,529 kB/s)                                     Reading package lists... Error! E: Read error - read (5: Input/output error) W: You may want to run apt-get update to correct these problems E: The package cache file is corrupted   If there's any more information you need, don't hesitate to ask in the comments.  Edit 1:  $ sudo df -h Filesystem      Size  Used Avail Use% Mounted on udev            5.9G     0  5.9G   0% /dev tmpfs           1.2G  9.4M  1.2G   1% /run /dev/sda1       135G  7.2G  121G   6% / tmpfs           5.9G   14M  5.9G   1% /dev/shm tmpfs           5.0M  4.0K  5.0M   1% /run/lock tmpfs           5.9G     0  5.9G   0% /sys/fs/cgroup tmpfs           1.2G   88K  1.2G   1% /run/user/1000 /dev/sdb1       932G  300G  633G  33% /media/adoria298/MDrive1   Edit 2 SMART Test results: Let $U\subset \mathbb{C}$ be a nonempty connected open set such that for every $z\in U$, $\overline z\in U$.  Let $f$ be analytic on $U$. Suppose $f(x)\in\mathbb R$ for every $x\in U\cap\mathbb R$. Prove that $f(\overline{z})=\overline{f(z)}$ for any $z \in U$.    By definition, I know that $f$ analytic on $U$ means that for every $z_0 \in U$, there exists $r&gt;0$ and a sequence of complex numbers $\left(a_n\right)_{n=0}^\infty$ such that $f(z)=\sum_{n=0}^\infty a_n\left(z-z_0\right)^n$ on the disc $D(z_0,r)\subseteq U$. I see that $f$ takes points without imaginary components to other points without imaginary components. But I don't see how this implies a symmetry that $f(\overline{z})=\overline{f(z)}$ for $z \in \mathbb C \setminus \mathbb R$. It seems like a very strong conclusion and I'm not sure how I would prove it.  I have also shown in the preceding question that $U\cap\mathbb R$ contains an open interval, however I am not sure if that detail is meant to be helpful to this question. using underscore's “difference” method on arrays of objects The other day I was looking at Stack Overflow on my Android phone. All is made very nice and all, but I could not find the Review button/link. Is it being implemented, did I miss it, or it is not available? Extracting extension from filename in Python Reviewed suggested edit view for title-only edits takes body of last revision? Yesterday I was pointed at some rejected suggested edits. Some of the corrections were valid, so I edited the posts accordingly, while making several further edits. Looking at the suggested edits now however, it seems that for those posts where only changes to the title were originally suggested, the post mortem suggested edit view now incorporates the body of the latest revision. (Or at least it appears like that to me)  Take for example . If you take a look at  of that post, you will see my later edits. The edited body seems to have been incorporated in the suggested edit view. For edits where originally changes to the body were suggested, there is no such confusion.   Why does this matter? In the case of some post mortem discussions or explanations it might help to see the actual situation as it was when the edit was suggested. Especially in the case of edits that might be considered too minor.   So have I stumbled upon a bug here? I have this table but check constraint is throwing me an error:     Column CHECK constraint for column 'MedicamentRegulated' references another column, table 'Medicaments'.   I've seen this as allowed in SQL Server but I don't know why it doesn't work :/  CREATE TABLE Medicaments ( MedicamentID INT NOT NULL IDENTITY(1,1) PRIMARY KEY, Name VARCHAR(50), DateValidity DATE, MedicamentRegulated BIT CHECK((MedicamentRegulated = 1 AND DateValidity IS NOT NULL)    OR MedicamentRegulated = 0) ) Whenever I try to install anything with the Ubuntu Software Center, the following error appears.     Failed to download repository information      Check your Internet connection.      E:Unable to parse package file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_multiverse_i18n_Index (1) How to show that all points are inside of unit circle? There are $n$ points on the plane. Any $3$ of them are inside of a unit circle. How to show that all points are inside of unit circle?  It is needed to prove that if there is a unit circle for each $3$  points which contains them, there is also a unit circle which contains all $n$ points. How to remove all subviews? What do ellipsis [...] mean in a list? If $R$ is an infinite ring, then $R$ has either infinitely many zero divisors, or no zero divisors Please help me to prove that if $R$ is an infinite ring, then $R$ has either an infinite number of zero divisors, or it has no zero divisors. What exactly does the *frequency* of a photon mean? I have a PHP script that can encode a PNG image to a Base64 string.  I'd like to do the same thing using JavaScript. I know how to open files, but I'm not sure how to do the encoding. I'm not used to working with binary data. How do I create my own URL protocol? (e.g. so://...) I have seen:   http://www... ftp://blah.blah... file://blah.blah... unreal://blah.blah... mailto://blah.blah...   What is that first section where you see http and the like called?  Can I register my own? Why not use "which"? What to use then? When looking for the path to an executable or checking what would happen if you enter a command name in a Unix shell, there's a plethora of different utilities (which, type, command, whence, where, whereis, whatis, hash, etc).  We often hear that which should be avoided. Why? What should we use instead? What does the [Flags] Enum Attribute mean in C#?