Displaying 8 results from an estimated 8 matches for "xprime".
Did you mean:
prime
2009 Feb 17
6
Percentiles/Quantiles with Weighting
...s/percentiles within R while also using a
weighting schema, I would be very interested.
Note - this function supposes the data in X is time-sequenced, with the most
recent (and thus heaviest weighted) data at the end of the vector
WtPercentile <- function(X=rnorm(100), pctile=seq(.1,1,.1))
{
Xprime <- NA
for(i in 1:length(X))
{
Xprime <- c(Xprime, rep(X[i], times=i))
}
print("Percentiles:")
print(quantile(X, pctile))
print("Weighted:")
print(Xprime)
print("Weighted Percentiles:")
print(quantile(Xprime, pctile, na.rm=TRUE))
}
WtPerce...
2003 May 01
4
List of lists? Data frames? (Or other data structures?)
...aa bb
a 1 "A"
b 2 "B"
The advantage of this is that I could access all the individual
components easily. Also I could access all the rows and columns
easily.
Alternatively, I could have a list of lists that looks like this:
xprime <- list()
xprime$a <- list()
xprime$b <- list()
xprime$a$aa <- 1
xprime$a$bb <- "A"
xprime$b$aa <- 2
xprime$b$bb <- "B"
etc.
If speed is important, would a list of lists be faster than a data
frame? (I know, for example, that scan is supposed to be faste...
2007 Aug 13
1
simulate data from multivariate normal with pre-specified correlation matrix
...ation 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
sigma[i,j]<-rho^abs(i-j)
sigma[i,i]<-1
}
}
# create a data set of 10 observations from multivariate normalcovariance matrix sigma
library(MASS)
Xprime<-mvrnorm(N,rep(1,p), sigma )
Also, if I calculate
S<- cov(Xprime)
will S be the sample correlation matrix?
Thank you very much for your time!
2009 Jun 12
1
coupled ODE population model
...ollowing;
the system consists of s species, i= 1, 2,...,s
network of interactions between species is specified by a (s x s) real matrix,
C[i,j]
x[i] being the relative population of the "ith" species (0 =< x[i] =< 1,
sum(x[i]=1)
the evolution rule being considered is as follows;
xprime[i] = f[i] if x[i] > 0 or f[i] >= 0
xprime[i] = 0 if x[i] = 0 and f[i] < 0
where f[i] = sum(C[i,j]*x[j]) - x[i]*sum(C[k,j]*x[j])
I have a bit of attempted code written out, but are there any tricks or tips
that would condense or make this mess look nicer?
-Justin
2010 Jul 03
1
Inverting a scale(X)
G'day, All.
I have been trying to trackdown a problem in my R analysis script. I perform a scale() operation on a matrix then do further work.
Is there any way of inverting the scale() such that
sX <- scale(X)
Xprime <- inv.scale(x); # does inv.scale exist?
resulting in Xprime_{ij} == X_{ij} where Xprime_{ij} \in R
There must be some way of doing it but I'm such a newb that I haven't been able to find it.
Thanks
Godfrey
2003 Nov 13
0
Help: Strange MDS behavior
...Here is a sample code;
library(mva)
set.seed(12345)
x <- as.matrix(dist(matrix(rnorm(100),ncol=10,byrow=T)))
# x[1,2]<-x[2,1]<-1000 ## <<--** 1
# x[5,6]<-x[6,5]<-1000 ## <<--** 2
fit <- NULL
for(k in 1:9)
{
mds <- cmdscale(x,k,add=T)
xprime <- as.matrix(dist(mds$points))
fit[k] <- sum((x-xprime)^2)/sum(x^2)
}
plot(fit)
When I run this example, it gives a nice "good" plot. However, with
those two commented lines added, the plot is opposite, that is, the fit
is increasing as k grows!
I really don't und...
2011 Jan 12
2
plot: skip a range of axis
Hi,
I am using plot to show scatter points in 2_D.
in my data, there is no data between -1 and +1 in x-axis.
I want to skip this region, i.e. x axis becomes [-Inf:-1, 1:Inf].
can any one tell me how to do?
YU
[[alternative HTML version deleted]]
2012 Jan 30
1
about changing line type and line width in Taylor Diagram
Dear all,
I am new to plotting Taylor Diagram using plotrix package within R, hence
this post. I have written a script which plots Taylor Diagram with one
reference and 7 model values. However the font size, line width and line
type are not clear when saving the diagram as a jpeg file. I tried the
functions lty, lwd and font but no apparent change. I am attaching the
script here. Any help would