ReplicaX: Difference between revisions
Jump to navigation
Jump to search
(→Answer: example run link added) |
(→Answer: an interface for paste and save of data) |
||
| Line 13: | Line 13: | ||
Rcode ReplicaX by Juha Karvanen does exactly that. | Rcode ReplicaX by Juha Karvanen does exactly that. | ||
<rcode label="Save a replica of your data" graphics=1 variables=" | |||
name:dat|description:Copy your data table here|type:table| | |||
name:vartype|description:Give the variable types in format c('discrete','continuous')|type:default| | |||
name:k|description:Give the k parameter (default recommended)|default:5| | |||
name:osigma|description:Give the osigma parameter (default recommended)|default:0.5| | |||
name:verbose|description:Do you want to show the replica data on screen?|type:selection|options:FALSE;No, only save;TRUE;Yes, show and save|default:FALSE | |||
"> | |||
library(OpasnetUtils) | |||
library(Lmoments) | |||
library(bayesm) | |||
library(MASS) | |||
library(plyr) | |||
library(compiler) | |||
objects.latest("Op_en6248", code_name = "initiate") # Fetch the ReplicaX functions | |||
enableJIT(3) | |||
set.seed(20131103) #to reproduce the results | |||
#Generating replica data | |||
for(i in (1:ncol(dat))[vartype == 'continuous']) { | |||
colnames(dat)[i] <- levels(dat[[i]])[dat[[1 , i]]] | |||
dat[[i]] <- as.numeric(levels(dat[[i]])[dat[[i]]]) | |||
} | |||
dat <- dat[2:nrow(dat) , ] | |||
replica <- ReplicaX(dat, vartype, k = k, osigma = osigma) | |||
objects.put(replica) | |||
cat("The replica table is saved. Save the key of the model run to retrieve your data.\n") | |||
if(verbose) { | |||
cat("Copy the replica data from here.\n") | |||
oprint(replica) | |||
} else { | |||
cat("Your replica data looks like this:\n") | |||
oprint(head(replica)) | |||
} | |||
</rcode> | |||
[http://en.opasnet.org/en-opwiki/index.php/Special:R-tools?id=E9oTrZdmp563kVIx Show example data and analysis] (Making a new run takes ca. 4 minutes) | [http://en.opasnet.org/en-opwiki/index.php/Special:R-tools?id=E9oTrZdmp563kVIx Show example data and analysis] (Making a new run takes ca. 4 minutes) | ||
Revision as of 18:27, 10 December 2013
| Moderator:Jouni (see all) |
|
|
| Upload data
|
Question
How to generate an artificial data from a real data in such a way that
- individuals are no longer identifiable from the data,
- the marginal distributions are close to those of the original data,
- the correlation structure is close to that of the original data?
Answer
Rcode ReplicaX by Juha Karvanen does exactly that.
Show example data and analysis (Making a new run takes ca. 4 minutes)
Rationale
Functions
Replica R function by Juha Karvanen does exactly that.
- Description of ReplicaX in the Apps4Finland contest (in Finnish).
See also
- Monica project: data File:Monica.zip
- Portal:Data
- op_fi:Apps4Finland