search for: xa

Displaying 20 results from an estimated 288 matches for "xa".

Did you mean: ax
2012 Feb 09
1
Constraint on one of parameters.
...r a set of parameters and want to set a constraint on only one parameter. Here is my function. What I want to do is estimate the parameters of a bivariate normal distribution where the correlation has to be between -1 and 1. Would you please advise how to revise it? ex=function(s,prob,theta1,theta,xa,xb,xc,xd,t,delta) { expo1= exp(s[3]*xa+s[4]*xb+s[5]*xc+s[6]*xd) expo2= exp(s[9]*xa+s[10]*xb+s[11]*xc+s[12]*xd) expo3= exp(s[15]*xa+s[16]*xb+s[17]*xc+s[18]*xd) expo4= exp(s[21]*xa+s[22]*xb+s[23]*xc+s[24]*xd) expo5= exp(s[27]*xa+s[28]*xb+s[29]*xc+s[30]*xd) nume1=prob[1]*(s[2]^-s[1]*s[1]*t^(s[1]-1)*...
2011 Aug 15
2
plotting segments only and in color
Hello, I've a question concerning the display of interval data. A sample dataset where X is an interval between Xa and Xb which should be displayed: Y=c(15,14,23,18,19,9,19,13) Xa=c(17,22,21,18,19,25,8,19) Xb=c(22,22,29,34,19,26,17,22) X = (Xa+Xb)/2 It's easily possible to plot the mean of the interval like: plot(X,Y) afterwards I can create lines for the interval with: segments(Xa,Y,Xb,Y) I think that...
2007 Dec 17
0
guidelines for consistency of vector functions
...ce of software that was carefully engineered for widespread use.) All of the above is a rough draft that could be discussed further (e.g., should '[.<-' go in level 1 or level 2?) if there was any interest in pursuing this suggestion. Comments? -- Tony Plate PS: Here's a few examples of running an automatic vector-functionality tester on some vector-like classes in R ("basic"="level 1", "extra"="level 2", and "bonus"="level 3" functions) (this might be hard to read if line wrapping happens -- I've attached...
2011 Mar 06
4
sorting & subsetting a data.frame
...ng alone works fine with(x, x[Sepal.Length==6.7,]) ##sorting alone works fine with(x, x[order(Sepal.Length, rev(sort(Species1))),]) ##gets subsetted, but not sorted as expected with(x, x[(Sepal.Length==6.7) & order(Sepal.Length, rev(sort(Species1))),]) ##gets subsetted, but sorts very strangely xa <- with(x, x[Sepal.Length==6.7,]); with(xa, xa[order(Sepal.Length, rev(sort(Species1))),]) xa <- with(x, x[Sepal.Length==6.7,]); with(xa, xa[order(rev(sort(Species1))),]) I've checked The R Inferno, Quick-R and several other places with no obvious solution. Any ideas? Regards Liviu --...
2007 Oct 13
2
the use of the .C function
...ll rights reserved. // // Returns psi function for real argument 'x'. // NOTE: Returns 1e308 for argument 0 or a negative integer. // #include <iostream.h> // or <stdio.h>? #include <math.h> #define el 0.5772156649015329 double psi(double x) { double s,ps,xa,x2; int n,k; static double a[] = { -0.8333333333333e-01, 0.83333333333333333e-02, -0.39682539682539683e-02, 0.41666666666666667e-02, -0.75757575757575758e-02, 0.21092796092796093e-01, -0.83333333333333333e-01, 0.4...
2011 Nov 22
5
x, y for point of intersection
...this point. For exemplification consider this: ? ? set.seed(123) ? k1 <-rnorm(100, mean=1.77, sd=3.33) ?k1 <- sort(k1) q1 <- rnorm(100, mean=2.37, sd=0.74) q1 <- sort(q1, decreasing = TRUE) plot(k1, q1, xlim <- c((min(k1)-5), (max(k1)+5)), type="l") ? ya <- 2 xa = -5 yb=4 xb=12 ? lines(c(xa, xb), c(ya, yb), col = 2) ? # I want to get the x and y coordinates of the intersection of the 2 lines ?. ? m <- (ya-yb)/(xa-xb) b <- ya-m*xa ln <- loess(q1~k1) lines(ln) ? It is clear that the x, y will satisfy both linear equations, y = m*x + b a...
2006 Aug 02
1
RE
Hi any, Can some please detail me the createX command in bayesm package? To make things easy for you to help me, let me put forward my problem Suppose I have 3 covariates (say X matrix) and my Y has 3 categories say (1,2,3). Now from the CreateX I understand that the data matrix say 'Xa' must be of dimension n* (naxp), where 'na' is the number of variables and 'p' is the number of categories that Y has and 'n' is the number of observations. Now the Xa matrix will have 9 columns if I give na=3 and p=3, and 6 columns if I give na =2 and p=3. I underst...
2009 Mar 20
1
Mean-replacing NAs in a 3d array
Hi all I have a 3d array containing missing values. > Xa , , 1 [,1] [,2] [1,] 1 3 [2,] NA 4 , , 2 [,1] [,2] [1,] 5 7 [2,] NA NA , , 3 [,1] [,2] [1,] 9 11 [2,] 10 12 I want to replace the missing values with the mean, but the mean of each 'page' in the array (wrong terminology I'm sure). So -...
2011 Oct 10
4
correlation matrix
Hello Gurus I have two correlation matrices 'xa' and 'xb' set.seed(100) d=cbind(x=rnorm(20)+1, x1=rnorm(20)+1, x2=rnorm(20)+1) d1=cbind(x=rnorm(20)+2, x1=rnorm(20)+2, x2=rnorm(20)+2) xa=cor(d,use='complete') xb=cor(d1,use='complete') I want to combine these two to get a third matrix which should...
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all Is there a simpler method to achieve the following: When I obtain an empty data.frame after subsetting, I need for it to contain one line of NAs. Here's a dummy example: > (.xb <- iris[ iris$Species=='zz', ]) [1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species <0 rows> (or 0-length row.names) > dim(.xb) [1] 0 5 > (.xa <- data.frame(matrix(rep(NA, ncol(.xb)), 1))) X1 X2 X3 X4 X5 1 NA NA NA NA NA > names(.xa) <- n...
2017 May 30
2
Pseudo-instruction that overwrites its input register
On Tue, 30 May 2017, Nemanja Ivanovic wrote: > This is typically accomplished with something like PPC's `RegConstraint` and > `NoEncode`. You can see examples of it that are very similar to what you're after in > PPC's load/store with update forms (i.e. load a value and update the base register > with the effective address - these are used for pre-increment loads/stores). > For example: the definition of LBZU and friends in lib/Targ...
2004 Mar 10
3
converting lists got by tapply to dataframes
I have two lists: xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) ) xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site , FUN=function(z)yield[z])) I can convert xa to a dataframe easily with: as.data.frame(xa) But if i try the same with xb I get: as.data.frame(xb) Error in as....
2013 Apr 16
1
avoid losing data.frame attributes on cbind()
Dear all, How should I add several variables to a data frame without losing the attributes of the df? Consider the following: > require(Hmisc) > Xa <- iris > label(Xa, self=T) <- "Some df label" > str(Xa) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7...
2012 Jun 21
4
convert 'character' vector containing mixed formats to 'Date'
..."13/04/2004" "2/5/2005" "2/5/2005" "7/5/2007" "22/04/2004" [7] "21/04/2005" "20080430" "13/05/2003" "20080529" NA NA [13] "19/05/1999" "17/05/2000" "17/05/2000" > sum(xa <- grepl('/', x)) [1] 11 > sum(xb <- grepl('200', substr(x, 1,4))) [1] 2 > sum(xc <- is.na(x)) [1] 2 > x[xa] <- as.Date(x[xa], format="%d/%m/%Y") > x[xb] <- as.Date(x[xb], format="%Y%m%d") > x [1] "12843" "12521&quot...
2009 Nov 25
1
group generics
...lasses A and B, where B contains A. In the implementation of the group generic for B I would like to use the corresponding group generic for A. Is there a way to do that? I would also appreciate any comments if what I'm trying to do seems like the wrong approach. Here's a stripped down example: setClass("A", representation=representation(xa="numeric") ) setMethod("Arith", signature(e1="numeric", e2="A"), function(e1, e2) { new("A", ax=e1*e2 at xa) } ) setClass("B", represent...
2011 Dec 07
4
bug in rank(), order(), is.unsorted() on character vector
Hi, This looks OK: > x <- c("_1_", "1_9", "2_9") > rank(x) [1] 1 2 3 But this does not: > xa <- paste(x, "a", sep="") > xa [1] "_1_a" "1_9a" "2_9a" > rank(xa) [1] 2 1 3 Cheers, H. > sessionInfo() R version 2.14.0 (2011-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C...
2013 Jul 16
2
Problem following an R bug fix to integrate()
...other systems): > fn <- function(x, y) ifelse(x^2 + y^2 <= 1, 1 - x^2 - y^2, 0) > tol <- 1.5e-8 > fy <- function(x) integrate(function(y) fn(x, y), 0, 1, subdivisions = 300, rel.tol = tol)$value > Fy <- Vectorize(fy) > xa <- -1; xb <- 1 > Q <- integrate(Fy, xa, xb, subdivisions = 300, rel.tol = tol)$value Error in integrate(Fy, xa, xb, subdivisions = 300, rel.tol = tol) : roundoff error was detected Obviously, this realizes a double integration, split up into two 1-dimensio...
2007 Jul 04
1
Calling C Code from R
...eb) Statistician NSW Department of Commerce Sydney, Australia testCX1.C -------------- /* ********************* testCX1.c ********************* */ #include <R.h> #include <Rdefines.h> #include <Rmath.h> SEXP testC1(SEXP a) { int i, nr; double *xa, *xw, tmp; SEXP w; PROTECT(a = coerceVector(a, REALSXP)); nr = length(a); printf( "Length : %d \n", nr); PROTECT(w = allocVector(REALSXP, 1)); xa = REAL(a); xw = REAL(w); tmp = 0.0; for (i = 0; i < nr; i++) { tmp += xa[...
2011 Jul 28
1
Regression with ranges and displaying them in an XY-Plot
Hello UseRs, I've got 3 variables, the dependent variable Y as well as a max and a min value of the independent variable (Xa and Xb) where in some cases Xa=Xb (so actually a single value for X). First I'd like to perform a regression, but my problem is that my X is a range (acutally a censored independent variable Xa-Xb) rather then one single value. I know already some possible approaches like Bayesian Regression or...
2006 Oct 02
0
Arrowheads at line-ends
...ows, but this solution appears too be quite inflexible. So my question to the more experienced R-users out there is if there is a smarter way to do this? Is there, for instance, any graphing property that automaticly insert arrowheads? Here's the code of my "manual" solution: xA <- c(0.0000,0.0968,0.2340,0.4645,0.6115,0.8890,1.0000) Va <- c(69.016,69.769,70.775,72.456,73.280,73.564,73.921) Vb <- c(18.020,17.822,17.480,16.897,16.277,13.833,13.101) plot(c(0,1), c(10,80), type="n", xlab=expression(x[aceton]), ylab="Partielt molart volum", bty...