Displaying 20 results from an estimated 400 matches similar to: "How to generate a correlated binary data set?"
2009 Oct 29
1
correlated binary data and overall probability
Dear All,
I try to simulate correlated binary data for a clinical research project.
Unfortunately, I do not come to grips with bindata().
Consider
corr<-data.frame(ID=as.factor(rep(c(1:10), each=5)),
task=as.factor(rep(c(1:5),10)))
[this format might be more appropriate:]
corr2<-data.frame(ID=as.factor(rep(c(1:10),5)),
tablet=as.factor(rep(c(1:5),each=10)))
Now, I want to
2011 Mar 19
3
Generating repeated measures data
How would one generate data to be used in a simulation of a repeated measures ANOVA given a known (1) within-person correlation with known (2) mean and SD of data obtained at each of three times of observation?
Thanks,
John
John Sorkin
Chief Biostatistics and Informatics
Univ. of Maryland School of Medicine
Division of Gerontology and Geriatric Medicine
JSorkin at grecc.umaryland.edu
2013 Mar 05
3
Simulate binary correlated data
Dear R experts,
I am trying to simulate correlated binary data and have stumbled upon the
following problem:
With the help of "binarySimCLF" or "mvpBinaryEp" I have been able to
simulate correlating binary vectors given certain mean values and a desired
correlation. My problem is that these procedures do not allow you to specify
the exact vector for which you want to generate
2000 Jul 28
2
Loop removal?
Dear all,
I've got a quite large dataframe (stor) with rows subject and rt (reaction
time). I would like to split the reaction times per subject into 6 bins of
equal size. Right now, I'm using the following code:
bindata <- function(rt) {
bindata <- rep(-1,length(rt))
binwidth <- length(rt)/6
bindata[order(rt)[(0*binwidth)+1:(1*binwidth)]] <- 1
2007 Jul 03
3
generating correlated Bernoulli random variables
Hi all,
I was wondering how to generate samples for two RVs X1 and X2.
X1 ~ Bernoulli (p1)
X2 ~ Bernoulli (p2)
Also, X1 and X2 are correlated with correlation \rho.
Regards,
Vineet
[[alternative HTML version deleted]]
2002 Sep 03
1
Bindata package problems
Dear list
I am having a couple of problems with the package 'bindata'.
Having installed it using install.packages("bindata"), I am finding that
when I load it up as a library I get the following errors:
> library(bindata)
Loading required package: e1071
Loading required package: mvtnorm
Warning messages:
1: There is no package called `e1071' in: library(package, char
2011 Apr 14
2
How to see a R code from a package?
Dear R users,
Hi. I want know R code of a function: predict.cv.glmnet (which is
included in glmnet package).
Could you let me know how I can see the R code of the function?
Thank you,
Soyeon Kim
2012 Dec 18
2
how to get a value from a list (using paste function)?
Dear my R friends,
I want to get a number from a list using paste function.
In my example,
lambda.rule <- "lambda.1se"
cvtest is a list (result from cv.glmnet)
and
cvtest$lambda.1se
[1] 1.308973
I want to call the value using paste function.
I used get function but there was an error.
test <- get(paste("cvtest$",lambda.rule, sep=""))
Error in
2010 Sep 20
2
how to seperate " "? or how to do regression on each variable when I have multiple variables?
Dear All,
I have data which contains 14 variables. And I have to regress one of
variables on each variable (simple 13 linear regressions)
I try to make a loop and store only R-squared
colnames(boston)
[1] "CRIM" "ZN" "INDUS" "CHAS" "NOX" "RM" "AGE"
[8] "DIS" "RAD"
2011 Jun 09
4
set.seed and for loop
Dear All,
This is hard to describe so I made a simple example.
set.seed(1001)
total <- 0
data <- vector("list", 30)
for(i in 1:30) {
data[[i]] <- runif(50)
}
Let's call a data set runif(50).
While the for loop is running, 100 data sets are generated.
I want to restore 23th data set (the data set generated in 23th for
loop) without the loop.
I've tried set.seed(1023)
2010 Dec 13
2
How to change leaf color by group in hclust plot or how to install A2R package in windows?
I want to change leaf color by group in hclust plot.
I've seen several answers about A2R package but I cannot install A2R
and Rtools in windows.
Do you know how to install A2R package in windows or how to change
leaf color by group in hclust plot?
Thank you in advance,
Soyeon
2011 Apr 15
2
prediction error in ROCR package when sampled y consists of only one class
Dear R users,
Hi. I am using prediction function in ROCR package.
y consists of two classes 0 and 1.
However, since I am using cross-validation, a sampled small number of
y may consist of only one class
>y
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In this case, prediction function gives an error:
Error in prediction(predic, y) : Number of classes is not equal to 2.
ROCR currently supports
2019 Mar 25
2
R 3.5.3 having trouble spawning a new process on my Windows 10 machine
Hi all,
I am noticing some strange behaviour so I am bringing to this list. In the
past when I have submitted bugs to bugzilla, I have come here first for
confirmation/advice. Hopefully this is appropriate.
Upgrading from R 3.5.2 to R 3.5.3 seems to have elicited some strange
behaviour on my Windows machine. R seems to have trouble spawning a new
process on my machine. You can noticing with all
2015 Jan 26
4
problem with update.packages() in R-Devel (3.2.0) on Windows
Dear all,
I've noticed the following problem for the past several days:
---------------- snip ----------------
> update.packages(ask=FALSE)
. . .
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/zoo_1.7-11.zip'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL
'http://cran.utstat.utoronto.ca/src/contrib/zoo_1.7-11.zip'
2012 Sep 27
2
Generating an autocorrelated binary variable
Hi R-fellows,
I am trying to simulate a multivariate correlated sample via the Gaussian copula method. One variable is a binary variable, that should be autocorrelated. The autocorrelation should be rho = 0.2. Furthermore, the overall probability to get either outcome of the binary variable should be 0.5.
Below you can see the R code (I use for simplicity a diagonal matrix in rmvnorm even if it
2011 May 12
2
Change font size in Windows
My day for dumb questions. How do I increase the type size in the Rgui console in Windows? (R-2.13.0, Windows 7)
It looked to me that I just needed to change the font spec in Rconsole but that does not seem to be working.
The R FAQ for Windows has a reference in Q3.4 to changing fonts, (Q5.2), but I don't see anything relevant there.
Rconsole originally was:
font = TT Courier New
points =
2007 Jun 07
2
character to time problem
I am trying to clean up some dates and I am clearly
doing something wrong. I have laid out an example
that seems to show what is happening with the "real"
data. The coding is lousy but it looks like it
should have worked.
Can anyone suggest a) why I am getting that NA
appearing after the strptime() command and b) why the
NA is disappearing in the sort()? It happens with
na.rm=TRUE
2007 Feb 07
3
generate Binomial (not Binary) data
Dear All,
I am looking for an R function or any other reference to generate a series of correlated Binomial (not a Bernoulli) data. The "bindata" library can do this for the binary not the binomial case.
Thank you,
Bernard
---------------------------------
[[alternative HTML version deleted]]
2011 Aug 10
2
Opposite of paste function
Dear All,
I have vn variable
> vn
[1] "V300" "V376"
What I want to get is
300 376
without V and "" from vn variable.
Could you help me about this issue?
Thank you,
Soyeon
[[alternative HTML version deleted]]
2008 Oct 10
2
Fatal error: unable to restore saved data in .RData
Hello,
I am unable to start an R session by double-clicking on an existing
.RData file from the Windoze file explorer.
A dialogue appears with the message
"Fatal error: unable to restore saved data in .RData",
and I notice in the R Console the last few lines are:
"Loading required package: R2HTML
NULL
error in function () : unused argument(s) (1:43)"
I tried starting