Displaying 20 results from an estimated 8000 matches similar to: "simulate data for lme"
2007 Jan 28
2
nnet question
Hello,
I use nnet to do prediction for a continuous variable.
after that, I calculate correlation coefficient between predicted value and
real observation.
I run my code(see following) several time, but I get different correlation
coefficient each time.
Anyone know why?
In addition, How to calculate prediction accuracy for prediction of
continuous variable?
Aimin
thanks,
> m.nn.omega
2005 Sep 27
1
Simulate phi-coefficient (correlation between dichotomous vars)
Newsgroup members,
I appreciate the help on this topic.
David Duffy provided a solution (below) that was quite helpful, and came
close to what I needed. It did a great job creating two vectors of
dichotomous variables with a known correlation (what I referred to as a
phi-coefficient).
My situation is a bit more complicated and I'm not sure it is easily
solved. The problem is that I must
2006 Jun 28
1
Simulate dichotomous correlation matrix
Newsgroup members,
Does anyone have a clever way to simulate a correlation matrix such that
each column contains dichotomous variables (0,1) and where each column
has different prevalence rates.
For instance, I would like to simulate the following correlation matrix:
> CORMAT[1:4,1:4]
PUREPT PTCUT2 PHQCUT2T ALCCUTT2
PUREPT 1.0000000 0.5141552 0.1913139 0.1917923
PTCUT2
2009 Jan 31
1
FW: can't get package boot to load
Changing
library(RODBC,boot)
to
library(RODBC)
library(boot)
seems to have solved the problem.
_____
_____________________________________________
From: Gary Smith [mailto:gary.smith28 at comcast.net]
Sent: Saturday, January 31, 2009 12:55 PM
To: 'r-help at R-project.org'
Subject: can't get package boot to load
Hi,
I am new to R and I'm totally confused by this problem.
2010 Mar 09
0
varComb in gls/lme
Dear R-help members,
I have a question regarding how to use varComb function to specify a
variance function for the "weights" in the gls. I need to fit a
linear model with heteroscedasticity. The variance function is
exp(c0+nu0*W +nu1*W^2) where W is a covariate. Initially I want to use
varFunc to define my own variance function following the instruction in
the Pinheiro and
2009 Jan 31
0
can't get package boot to load
Hi,
I am new to R and I'm totally confused by this problem. I'm trying to load
data and run a simple correlation using corr() in the boot package.
Yesterday my code worked. Today it can't find the function corr(). I've
tried searching the web and haven't found the root of my problem. Apologies
if I've missed the obvious.
My code is simple:
2007 Mar 16
1
ideas to speed up code: converting a matrix of integers to a matrix of normally distributed values
Hi all,
[this is a bit hard to describe, so if my initial description is
confusing, please try running my code below]
#WHAT I'M TRYING TO DO
I'd appreciate any help in trying to speed up some code. I've written
a script that converts a matrix of integers (usually between 1-10,000
- these represent allele names) into two new matrices of normally
distributed values (representing
2009 Apr 21
4
My surprising experience in trying out REvolution's R
I care a lot about R's speed. So I decided to give REvolution's R
(http://revolution-computing.com/) a try, which bills itself as an
optimized R. Note that I used the free version.
My machine is a Intel core 2 duo under Windows XP professional. The code
I run is in the end of this post.
First, the regular R 1.9. It takes 2 minutes and 6 seconds, CPU usage
50%
Next, REvolution's R.
2008 Nov 11
1
simulate data with binary outcome and correlated predictors
Hi,
I would like to simulate data with a binary outcome and a set of predictors that are correlated. I want to be able to fix the number of event (Y=1) vs. non-event (Y=0). Thus, I fix this and then simulate the predictors. I have 2 questions:
1. When the predictors are continuous, I can use mvrnorm(). However, if I have continuous, ordinal and binary predictors, I'm not sure how to simulate
2004 Aug 09
0
Need help on this problem!
Hi everyone,
I have posted a similar question to this list, but I don't
get a reply. I really want to solve this problem, so I
post it again...
I am trying to use R to fit some mixed-effects models for
a nested data. The data is a simulated data with 111
subjects. Each subject has 6 waves' data. Below are the
first two subjects' data :
> simu1[1:12,]
Grouped Data: gf ~ age |
2011 Apr 17
1
How to retrieve a vector of a data.frame's variable attributes?
Hi,
I have a data.frame with 100 variables and I have assigned a "label",
"units" and "category" attribute to each variable. I would like to reorder
the variables in the data.frame by the "category" attributes but can't find
a way.
For example, the first variable is:
> attributes(hh$aez)
$levels
[1] "coastal" "forest"
2005 Sep 09
2
Simulate phi-coefficient
Looking for help with the following problem.
Given a sample of zeros and ones, for example:
> VECTOR1<-rep(c(1,0),c(15,10))
> VECTOR1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
How would I create a new sample (VECTOR2) also containing zeros and
ones, in which the phi-coefficient between the two sample vectors was
drawn from a population with a known
2011 Jul 06
1
Create simulated data's using mvrnorm
Hi All
This might be something very trivial but I seem to miss something in the
syntax or logic which makes me keep wandering around the problem without
arriving at a solution.
What I want to do is to simulate a sample data for performing cluster
analysis. I tried to use
x1= mvrnorm(10,rep(0.8,3),diag(3))
x2= mvrnorm(10,rep(0,3),diag(3))
x3= mvrnorm(10,rep(-0.5,3),diag(3))
x=rbind(x1,x2,x3)
2005 Jan 18
1
lme confusion
Hi, this is my first time using the nlme package, and I ran into the
following puzzling problem.
I estimated a mixed effects model using lme, once using groupedData, once
explicitly stating the equations. I had the following outputs. All the
coefficients were similar, but they're always slightly different, making me
think that it's not due to numerical error.
Also, what is the
2007 Aug 13
1
simulate data from multivariate normal with pre-specified correlation matrix
For example, the correlation matrix is 3x3 and looks like
1 0.75 0 0 0
0.75 1 0 0 0
0 0 0 0 0
Can I write the code like this?
p<- 3 # number of variables per observation
N<- 10 # number of samples
# define population correlation matrix sigma
sigma<-matrix(0,p,p) #creates a px p matrix of 0
rank<-2
for (i in 1:rank){
for (j in 1:rank){
rho<-0.75
2011 Jun 02
0
allowing individual level correlations to differ by cluster in lme in R
Dear R-listers,
I am fitting bivariate mixed models for cost-effectiveness data of cluster randomized trials using lme in R. So I have individuals nested within clusters. My response variable is a vector with bivariate response (individual level costs and effects) stacked into a single column. The covariates in my models are a constant and a treatment term. They are response-specific, e.g. a
2009 Sep 24
2
more strange behavior of Revolution R 1.3.0
It runs more than twice as slowly using 8 core than using a single core
in inverting large matrix. Tested on 8 core Windows XP 64 machine.
> n = 1000
> n.simu = 100
> func1 = function()
+ {
+ x = rnorm(n*n)
+ dim(x)=c(n,n)
+ y = solve(x)
+ }
>
> setMKLthreads(1)
> system.time(for(i in 1:n.simu) func1())
user system elapsed
69.48 2.42 71.91
2005 Dec 01
1
Simulate Correlated data from complex sample
Dear List:
I have created some code to simulate data from a complex sample where
5000 students are nested in 50 schools. My code returns a dataframe with
a variable representing student achievement at a single time point. My
actual code for creating this is below.
What I would like to do is generate a second column of data that is
correlated with the first at .8 and has the same means within
2003 Mar 05
3
reading in tab delimited data in a loop
Dear all,
I need to read in 4 sets of tab delimited data in a loop. The 4 data sets are called "simu1.dat", "simu2.dat" and so on. I know what I need on the righthand side of the read.table expression but I can't the left hand side of it to work (see the line in bold below). Can you kindly help? Many thanks.
simu1 <- matrix(0,30,3)
simu2 <- matrix(0,30,3)
simu3
2011 Jun 01
1
different results from lme() and lmer()
Hello R-help,
I'm studying an example in the R book.?
The data file is available from the link below.http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/fertilizer.txt
Could you explain Why the results from lme() and lmer() are different in the following case? In other examples, I can get the same results using the two functions, but not here...?
Thank you.Miya
library(lme4)library(nlme)#