Displaying 20 results from an estimated 5000 matches similar to: "lme() with two random effects"
2007 Sep 17
1
Create correlated data with skew
Hi all,
I understand that it is simple to create data with a specific
correlation (say, .5) using mvrnorm from the MASS library:
> library(MASS)
> set.seed(1)
>
> a=mvrnorm(
+ n=10
+ ,mu=rep(0,2)
+ ,Sigma=matrix(c(1,.5,.5,1),2,2)
+ ,empirical=T
+ )
> a
[,1] [,2]
[1,] -1.0008380 -1.233467875
[2,] -0.1588633 -0.003410001
[3,] 1.2054727 -0.620558768
2007 Jun 26
2
Power calculation with measurement error
Hi all,
Hopefully this will be quick, I'm looking for pointers to packages/
functions that would allow me to calculate the power of a t.test when
the DV has measurement error. That is, I understand that, ceteris
paribus, experiments using measure with more error (lower
reliability) will have lower power.
Mike
--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie
2007 Sep 27
3
Aggregate factor names
Hi all,
A suggestion derived from discussions amongst a number of R users in
my research group: set the default column names produced by aggregate
() equal to the names of the objects in the list passed to the 'by'
object.
ex. it is annoying to type
with(
my.data
,aggregate(
my.dv
,list(
one.iv = one.iv
,another.iv = another.iv
,yet.another.iv = yet.another.iv
)
2007 Jul 13
2
Suggestion to extend aggregate() to return multiple and/or named values
Hi all,
This is my first post to the developers list. As I understand it,
aggregate() currently repeats a function across cells in a dataframe
but is only able to handle functions with single value returns.
Aggregate() also lacks the ability to retain the names given to the
returned value. I've created an agg() function (pasted below) that is
apparently backwards compatible (i.e.
2006 Jun 28
2
webcal url
Hi
I''d like to create a webcal link to share a calendar with iCal like
it''s done in Basecamp for example.
I know how to create the file using icalendar ruby library and iCal
can open it, but if I send this file using an url like webcal://
localhost:3000/ical/1151495837
iCal says that data are not valid.
Any ideas?
Thanks.
PS here is my rb code
def ical_data
cal
2007 Aug 08
3
SWF animation method
Hi all,
Just thought I'd share something I discovered last night. I was
interested in creating animations consisting of a series of plots and
after finding very little in the usual sources regarding animation in
R directly, and disliking the imagemagick method described here
(http://tolstoy.newcastle.edu.au/R/help/05/10/13297.html), I
discovered that if one exports the plots to a
2007 Oct 01
3
optimize() stuck in local plateau ?
Hi all,
Consider the following function:
####
my.func = function(x){
y=ifelse(x>-.5,0,ifelse(x< -.8,abs(x)/2,abs(x)))
print(c(x,y)) #print what was tested and what the result is
return(y)
}
curve(my.func,from=-1,1)
####
When I attempt to find the maximum of this function, which should be
-.8, I find that optimize gets stuck in the plateau area and doesn't
bother testing the
2007 Jun 16
0
Fwd: How to set degrees of freedom in cor.test?
You could calculate the confidence interval of the correlation at
your desired df: http://davidmlane.com/hyperstat/B8544.html
The below code takes as arguments the observed correlation, N, and
alpha, calculates the confidence interval and checks whether this
includes 0.
cor.test2=function(r,n,a=.05){
phi=function(x){
log((1+x)/(1-x))/2
}
inv.phi=function(x){
2007 Aug 30
1
xyplot() groups scope issue
Hi all,
Tinkering with a wrapper for xyplot that will help me plot a bunch of
plots in a data analysis I'm doing and I ran into an odd error that
I'm guessing is a scope issue. Here's a very simple version of the code:
###############
#load lattice
library(lattice)
#create the wrapper function
do.xyplot = function( plot.formula, data.frame, plot.groups){
print(plot.groups)
2007 May 24
2
Calculation of ratio distribution properties
Hi all,
Looking to calculate the expected mean and variance of a ratio
distribution where the source distributions are gaussian with known
parameters and sample values are correlated. I see (from wikipedia:
http://en.wikipedia.org/wiki/
Ratio_distribution#Gaussian_ratio_distribution) that this calculation
is quite involved, so I'm hoping that someone has already coded a
function to
2007 Oct 06
1
Tricky vectorization problem
Hi all,
I'm using the code below within a loop that I run thousands of times
and even with the super-computing resources at my disposal this is
just too slow. The snippet below takes about 10s on my machines,
which is an order of magnitude or two slower than would be
preferable; in the end I'd like to set the number of monte carlo
experiments to 1e4 or even 1e5 to ensure stable
2006 Apr 02
4
Field#to_text
We''re using Vpim to parse iCal and vCard files, and so far it''s been
great. However, when we were parsing some iCal files we noticed that
all the endlines in the description section were disappearing. I start
peering through the source code and find (in the Field#to_text method
that is being called):
# The value as text. Text can have escaped newlines, commas, and escape
#
2007 Jan 18
1
windows 2003 can't map drives
I am running Samba Version 3.0.23a on a Solaris 10 machine.
On Windows XP I can map a drive to \\www\webcal
I can't do this on a WIndows 2003 machine. I get an error message stating
"The drive couldn't be mapped because no network was found"
I have not been able to find a solution for this.
Larry
2006 Jun 04
1
Nested and repeated effects together?
Dear R people,
I am having a problem with modeling the following SAS code in R:
Class ID Gr Hemi Region Gender
Model Y = Gr Region Hemi Gender Gr*Hemi Gr*Region Hemi*Region
Gender*Region Gender*Hemi Gr*Hemi*Region Gender*Hemi*Region
Gr*Gender*Hemi*Region
Random Intercept Region Hemi /Subject = ID (Gr Gender)
I.e., ID is a random effect nested in Gr and Gender, leading to
ID-specific
2010 Jan 21
1
Simple effects with Design / rms ols() function
Hi everyone,
I'm having some difficulty getting "simple effects" for the ols()
function in the rms package. The example below illustrates my
difficulty -- I'll be grateful for any help.
#make up some data
exD <- structure(list(Gender = structure(c(1L, 2L, 1L, 2L, 1L, 1L, 1L,
2L, 1L, 2L, 2L, 2L, 1L, 2L), .Label = c("F", "M"), class = "factor"),
2006 Feb 20
0
vpimd, a personal information server
This isn''t even close to ready for release, but in case anybody is
interested, has feedback, finds it useful as is, or even wants to
collaborate...
I''ve been working on a "personal information server", something of a
protocol multiplexer. Right now it serves calendar feeds for:
- a local calendar folder (iCal 1.x''s Library/Calendars)
- rss for local todos
2005 Mar 10
1
contrast matrix for aov
How do we specify a contrast interaction matrix for an ANOVA model?
We have a two-factor, repeated measures design, with
Cue Direction (2) x Brain Hemisphere(2)
Each of these has 2 levels, 'left' and 'right', so it's a simple 2x2 design
matrix. We have 8 subjects in each cell (a balanced design) and we want to
specify the interaction contrast so that:
CueLeft>CueRght
2006 Mar 18
1
Time-Series, multiple measurements, ANOVA model over time points, analysis advice
Hi,
I have some general questions about statistical analysis for a research
dataset and a request for advice on using R and associated packages for a
valid analysis of this data. I can only pose the problem as how to run
multiple ANOVA tests on time series data, with reasonable controls of the
family-wise error rate. If we run analysis at many small sections of a long
time-series, the Type-I
2006 Jul 21
1
Cuesheets and metaflac
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to use flac to make backups of my CD collection, and am
running into problems with disks that contain a pregap (or lead-in)
before the start of track one.
cdrdao rips these disks *WITHOUT* the pregap, and puts a PREGAP entry
into the cue file. For my test CD (Police, Synchronicity, catalog#
0082839373524) I get (in part):
TRACK 01
2006 Feb 08
1
ERROR: no applicable method for "TukeyHSD"
Why do I see this error?
> library(stats)
> require(stats)
[1] TRUE
>
> tHSD <- TukeyHSD(aov)
Error in TukeyHSD(aov) : no applicable method for "TukeyHSD"
In case it helps:
> aov
Call:
aov(formula = roi ~ (Cue * Hemisphere) + Error(Subject/(Cue *
Hemisphere)), data = roiDataframe)
Grand Mean: 8.195069
Stratum 1: Subject
Terms:
Residuals
Sum