Displaying 20 results from an estimated 3000 matches similar to: "loops: pasting indexes in variables names"
2004 Feb 05
2
xyplot (lattice): colours of lines
using either one of the following codes:
xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject,
col = treatment)
xyplot(X ~ time | center, groups = subject,
panel = function(x, y, ...){
panel.superpose(x, y, col = treatment, type = "l", ...)
})
I get two different colours for the lines by these colours do not match the
corresponding
treatment
2003 Dec 08
1
Design functions after Multiple Imputation
I am a new user of R for Windows, enthusiast about the many functions
of the Design and Hmisc libraries.
I combined the results of a Cox regression model after multiple imputation
(of missing values in some covariates).
Now I got my vector of coefficients (and of standard errors).
My question is: How could I use directly that vector to run programs such
as 'nomogram', 'calibrate',
2007 Dec 25
2
rsyncd.conf exclude/include questions ??
Hello,
I get some troubles when rsyncing my FreeBSD 6.2 server from my iMac
Leopard desktop.
Below what I configured in rsyncd.conf ..
[all]
path = /
uid = root
gid = wheel
read only = true
include from = /home/rsync/etc/includes/rootfs
/home/rsync/etc/includes/rootfs
+ /etc
+ /etc/make.conf
+ /boot
+ /boot/*
- *
This is the only way I found to only backup files directories I would like
2004 Feb 04
1
xypplot (lattice): colours of lines
Using data from a multicenter study with a parallel-group design comparing
two treatments, I plotted each subject's time change of X after stratifying
for center:
xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject)
Now I want these lines to take different colours according to the variable
"treatment". Any help?
Umberto
2005 Jun 07
1
Variables values on intersected intervals
Dear R-list,
i have a problem, in the framework of simulations, i want to vectorize for
earning time: a variable, say X, has values on intervals and an other
variable, say Y, has values on other intervals. For example
Inf Sup X
0 2 1
2 4 2
4 6 3
and
Inf Sup Y
1 3 1
3 5 2
5 7 3
i want to create a matrix like this
Inf Sup
2008 Feb 28
3
Collapse an array
Suppose I have a 4-D array X with dimensions (dx, dy, dz, dp). I want
to collapse the first 3 dimensions of X to make a 2-D array Y with
dimensions (dx*dy*dz, dp). Instead of awkward looping, what is a good
way to do this? Is there a similar function like reshape in Matlab?
Thanks,
Gang
2011 May 18
1
Constrainted Nonlinear Optimization - lack of convergence
Hello,
I am attempting to utilize the 'alabama' package to solve a constrained
nonlinear optimization problem.
The problem has both equality and inequality constraints (heq and hin
functions are used). All constraints are smooth, i.e. I can differentiate
easily to produce heq.jac and hin.jac functions.
My initial solution is feasible; I am attempting to maximize a function,
phi. As
2006 Jul 08
2
String mathematical function to R-function
hello
I make a subroutine that give-me a (mathematical)
function in string format.
I would like transform this string into function ( R
function ).
thanks for any tips.
cleber
#e.g.
fun_String = "-100*x1 + 0*x2 + 100*x3"
fun <- function(x1,x2,x3){
return(
############
evaluation( fun_String )
############
)
True String mathematical function :-( :-(
> nomes
[1]
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users,
I'm trying to transform a matrix A into B (see below). Anyone knows how to
do it in R? Thanks.
Matrix A (zone to zone travel time)
zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0
B:
from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1
4.3 z3 z2 2.5 z3 z3 0
The real matrix I have is much larger, with more than 2000 zones. But I
think it should
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple
integration where some of the variables are in the bounds of the other
variables. I was trying to use R2Cuba function but cannot set the upper and
lower bounds. My code so far is :
int <- function(y){
u2 = y[1]
z2 = y[2]
u1 =y[3]
z1 = y[4]
ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2))
return(ff)
}
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script:
#1) read in data:
daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt',
header=TRUE, sep="\t")
daten<-as.matrix(daten)
#2) create empty matrix:
indxind<-matrix(nrow=617, ncol=617)
indxind[1:20,1:19]
#3) compare cells to each other, score:
for (s in 3:34) { #walks though the matrix colum by colum, starting at
2013 Oct 18
1
crr question in library(cmprsk)
Hi all
I do not understand why I am getting the following error message. Can
anybody help me with this? Thanks in advance.
install.packages("cmprsk")
library(cmprsk)
result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function
2008 Oct 04
3
How to plot countours with fixted densities?
Hello,
I used the following codes to generate bivariate normal dependence structure with unit Frechet margins.
Sigma <- matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate
y <- mvrnorm(Nsam, c(0,0), Sigma) # random
v <- cbind(pnorm(y[,1],mean = 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1))
z <- cbind(-1/log(v[,1]),-1/log(v[,2]))
z1 <- z[,1]
z2 <- z[,2]
And to
2002 Mar 27
2
Error with nls
Dear R-group members,
I use:
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
I try to fit a 2 compartment model. The compartments are open, connected
to each other and
2006 Jun 15
3
matrix selection return types
Dear Rusers,
I would like some comments about the following results
(under R-2.2.0)
> m = matrix(1:6 , 2 , 3)
> m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
> z1 = m[(m[,1]==2),]
> z1
[1] 2 4 6
> is.matrix(z1)
[1] FALSE
> z2 = m[(m[,1]==0),]
> z2
[,1] [,2] [,3]
> is.matrix(z2)
[1] TRUE
Considered together, I'm a bit surprised about
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and
z3 which is captured by "z"
and "prob" as described below.
For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13.
Also, the probability adds up to 1.
> head(z) z1 z2 z3
[1,] -0.46667 -1.0000 -1.0000
[2,] -0.33333 -0.9333 -0.9333
[3,] -0.20000 -0.8667 -0.8667
2006 Jun 14
3
A question about stepwise procedures: step function
Dear all,
I tried to use "step" function to do model selection, but I got an error massage. What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it?
***************************************************************************************************
2006 Mar 16
2
Using of LME function in non-replicate data
Hello all R-users!
In Jun-2005, I find the follow discussion about using
of
LME function ( in NLME library ) for fitting
non-replicate data
The thread: ANOVA vs REML approach to variance
component estimation
http://tolstoy.newcastle.edu.au/R/help/05/06/6498.html
Someone expose the follow problem:
# non-replicate data
y <- c(2.2, -1.4, -0.5, -0.3, -2.1, 1.5, 1.3, -0.3,
0.5, -1.4,
2008 Jul 11
1
Comparing complex numbers
Is there an easy way to compare complex numbers?
Here is a small example:
> (z1=polyroot(c(1,-.4,-.45)))
[1] 1.111111-0i -2.000000+0i
> (z2=polyroot(c(1,1,.25)))
[1] -2+0i -2+0i
> x=0
> if(any(identical(z1,z2))) x=99
> x
[1] 0
# real and imaginary parts:
> Re(z1); Im(z1)
[1] 1.111111 -2.000000
[1] -8.4968e-21 8.4968e-21
> Re(z2); Im(z2)
[1] -2
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
Dear All,
I would be very appreciative of your help with the following
1). I am running multivariate multiple regression through the manova() function (kindly suggested by Professor Venables) and getting two different answers for test=c("Wilks","Roy","Pillai") and tests=c("Wilks","Roy",'"Pillai") as shown below. In the