search for: x4

Displaying 20 results from an estimated 1109 matches for "x4".

Did you mean: 0x4
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0): > xtabs(~.,data[,idx:(idx+4)]) , , x3 = 1, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 31 2 0 0 112 3 0 0 94 , , x3 = 2, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 3, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 1, x4 =...
2013 Mar 15
2
Help finding first value in a BY group
I have a large Excel file with SKU numbers (stock keeping units) and forecasts which can be mimicked with the following: Period <- c(1, 2, 3, 1, 2, 3, 4, 1, 2) SKU <- c("A1","A1","A1","X4","X4","X4","X4","K2","K2") Forecast <- c(99, 103, 128, 63, 69, 72, 75, 207, 201) PeriodSKUForecast <- data.frame(Period, SKU, Forecast) PeriodSKUForecast Period SKU Forecast 1 1 A1 99 2 2 A1 103 3 3 A1...
2010 Dec 14
2
How to bind models into a list of models?
...t it looks like: > dd [1] "lm(y ~ 1,data=Cement)" "lm(y ~ X,data=Cement)" "lm(y ~ X1,data=Cement)" [4] "lm(y ~ X2,data=Cement)" "lm(y ~ X3,data=Cement)" "lm(y ~ X4,data=Cement)" [7] "lm(y ~ X + X1,data=Cement)" "lm(y ~ X + X2,data=Cement)" "lm(y ~ X + X3,data=Cement)" [10] "lm(y ~ X + X4,data=Cement)" "lm(y ~ X1 + X2,data=Cement)" "lm(y ~ X1...
2005 Oct 05
0
Ad: Re: Ad: Re: R crashes for large formulas in lm() (PR#8180)
Dette er en melding med flere deler i MIME-format. --=_alternative 004C4E4A00257091_= Content-Type: text/plain; charset="US-ASCII" Yes. so (x1*x2*x3*x4*x5*x6*x7*x8)^2 = (x1+x2+x3+x4+x5+x6+x7+x8)^8 ? and there is a difference in (x1*x2*x3*x4*x5*x6*x7*x8)^2 and (x1*x2*x3*x4*x5*x6*x7*x8) althoug the resulting formulas are the same, or? This fikses my problem, but R still crashes for the large formula. It may be due to stack owerflow, but i guess th...
2020 Sep 10
5
aplicar codigo
Hola: Como dice Carlos, algo así, por ejemplo: transforma <- function(df) sapply(df, function(x) ifelse(x%in%c("x1","x2","x3"), "prueba1",ifelse(x%in%c("x4","x5","x6"),"prueba2",x))) > transforma(df1)       col1  [1,] "prueba1"  [2,] "prueba1"  [3,] "x11"  [4,] "prueba1"  [5,] "x33"  [6,] "prueba1"  [7,] "prueba2"  [8,] "prueba2...
2005 Oct 05
0
Ad: Re: R crashes for large formulas in lm() (PR#8180)
On Wed, 5 Oct 2005 Hallgeir.Grinde at elkem.no wrote: > And some more informastion I forgot. > R does not crash if I write out the formula: > > set.seed(123) > x1 <- runif(1000) > x2 <- runif(1000) > x3 <- runif(1000) > x4 <- runif(1000) > x5 <- runif(1000) > x6 <- runif(1000) > x7 <- runif(1000) > x8 <- runif(1000) > y <- rnorm(1000) > fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2) > -> R crashes > > fit <- lm(y~x1+x2+x3+x4+x5+x6+x7+x8 > +x1:x2+x1:x3+...
2005 Oct 05
0
Ad: Re: Ad: Re: R crashes for large formulas in lm() (PR#8181)
On Wed, 5 Oct 2005 Hallgeir.Grinde at elkem.no wrote: > Yes. > so (x1*x2*x3*x4*x5*x6*x7*x8)^2 = (x1+x2+x3+x4+x5+x6+x7+x8)^8 ? Yes in the sense that the simplified formula given by terms() is the same. > and there is a difference in > (x1*x2*x3*x4*x5*x6*x7*x8)^2 > and > (x1*x2*x3*x4*x5*x6*x7*x8) > althoug the resulting formulas are the same, or? The first is...
2020 Sep 10
3
aplicar codigo
Hola, me gustar?a hacer algo como en el siguiente ejemplo A un df a?adirle una columna que es la transformaci?n de otra, en plan a todo lo que sea x1, x2, x3 lo llamo prueba 1 todo lo que sea x4,x5,x6 lo llamo prueba 2 el resto de x las dejo como est?n. Ser?a algo as? col1 <- c('x1', 'x2', 'x11', 'x1','x33', 'x1','x4', 'x5', 'x35', 'x1','x2', 'x4') df1<-data.frame(col1) attach(df1) df1$...
2016 May 22
3
Problemas con For
Hola comunidad XD, necesito ayuda con estola idea es que para cada valor del frame x4 si es cero ponga cerosino que ponga un valor del frame Nsinel cual tiene una estructura como % | n25% | 150% | 275% | 3100% | 4 y x4 tiene una cierta cantidad de valores en 0 (poco menos de la mitad pero varian aleatoriamente) y los demas un valor aleatorio entre 0 y 1Tomando en cu...
2012 Jan 05
1
delete.response leaves response in attribute dataClasses
...name of the dependent variable first in the in "dataClasses". It caused an unexpected behavior in my code, so (as usual) the bug may be mine, but in my heart, I believe it belongs to delete.response. To illustrate, here's a terms object from a regression. > tt y ~ x1 * x2 + x3 + x4 attr(,"variables") list(y, x1, x2, x3, x4) attr(,"factors") x1 x2 x3 x4 x1:x2 y 0 0 0 0 0 x1 1 0 0 0 1 x2 0 1 0 0 1 x3 0 0 1 0 0 x4 0 0 0 1 0 attr(,"term.labels") [1] "x1" "x2" "x3" &quo...
2020 Sep 10
2
aplicar codigo
...amura . escribió: > Gracias por las respuestas. > > Probé lo de hacer la función y no me salía. Pensaba que hacía algo mal. > Ahora con el código de Marcelino tampoco me sale. > > col1 <- c('x1', 'x2', 'x11', 'x1','x33', 'x1','x4', 'x5', 'x35', > 'x1','x2', 'x4') > col2 <- c('x12', 'x4', 'x6', 'x771','x4', 'x2') > col3 <- c('x7', 'x2', 'x4', 'x5','x111', 'x1','x4'...
2013 Apr 13
1
how to add a row vector in a dataframe
....psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1}) res1[,997:1000] #????? [,1]???????? [,2]???????? [,3]???????? [,4]??????? #x1??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x2??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x3??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x4??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x5??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x6??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x7??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x8??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x9??? N...
2005 Oct 05
1
Ad: Re: R crashes for large formulas in lm() (PR#8180)
...tte er en melding med flere deler i MIME-format. --=_alternative 004613C000257091_= Content-Type: text/plain; charset="US-ASCII" And some more informastion I forgot. R does not crash if I write out the formula: set.seed(123) x1 <- runif(1000) x2 <- runif(1000) x3 <- runif(1000) x4 <- runif(1000) x5 <- runif(1000) x6 <- runif(1000) x7 <- runif(1000) x8 <- runif(1000) y <- rnorm(1000) fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2) -> R crashes fit <- lm(y~x1+x2+x3+x4+x5+x6+x7+x8 +x1:x2+x1:x3+x1:x4+x1:x5+x1:x6+x1:x7+x1:x8 +x...
2008 Apr 21
1
Regression inclusion of variable, effect on coefficients
...question is not strictly R-help, yet, maybe some of the guru's in statistics can help me out. I have a sample of data all from the same "population". Say my regression equation is now this: m1 <- lm(y ~ x1 + x2 + x3) I also regress on m2 <- lm(y ~ x1 + x2 + x3 + x4) The thing is, that I want to study the effect of "information" x4. I would hypothesize, that the coefficient estimate for x1 goes down as I introduce x4, as x4 conveys some of the information conveyed by x1 (but not only). Of course x1 and x4 are correlated, however multicollinea...
2013 May 29
3
bootstrap
...; To: arun <smartpink111 at yahoo.com> Sent: Wednesday, May 29, 2013 9:05 AM Subject: bootstrap hi. i have these dataset:? set.seed(12345)? S=1000? generate <- function(size) {? x1 <- rnorm(size, mean=0, sd=1)? x2 <- rnorm(size, mean=0, sd=1)? x3 <- rnorm(size, mean=0, sd=1)? x4 <- rnorm(size, mean=0, sd=1)? x5 <- rnorm(size, mean=0, sd=1)? x6 <- rnorm(size, mean=0, sd=1)? x7 <- rnorm(size, mean=0, sd=1)? x8 <- rnorm(size, mean=0, sd=1)? x9 <- rnorm(size, mean=0, sd=1)? x10 <- rnorm(size, mean=0, sd=1)? e<-rnorm(size, mean=0, sd=1)? t_trueps <- (...
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello I have data like this x1 x2 x3 x4 x5 I want to create a matrix similar to a correlation matrix, but with the difference between the two values, like this x1 x2 x3 x4 x5 x1 x2-x1 x3-x1 x4-x1 x5-x1 x2 x3-x2 x4-x2 x5-x2 x3 x4-x3 x5-x3 x4...
2005 Oct 25
0
Beginner question on apply()
Dear all, I am an beginner with R and I have a question concerning apply(). My problem is as follows: I have data on four variables (x1,x2,x3,x4) with missing values for x1 and x2. > data[1:9,] x1 x2 x3 x4 1 NA NA 10 1 2 NA NA 8 3 3 NA NA 13 7 4 9 9 9 9 5 11 14 20 10 6 14 14 14 15 7 6 6 6 8 8 4 4 4 19 9 12 12 12 8 ..... I would like to replace the missing values by values sampled from the conditional distri...
2003 Oct 05
3
stepAIC problem
...on into a data.frame" every time I run the part of stepAIC. Even the following small program shows the same problem. Is stepAIC of the new version altered? Could anyone help me please? --small example > library(MASS) > x1<-runif(100) > x2<-runif(100) > x3<-runif(100) > x4<-runif(100) > x5<-runif(100) > y<-x1+x2+x3+runif(100) > t<-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5) > x<-lm(y~x1+x2+x3+x4+x5,data=t) > stepAIC(x) Start: AIC= -247.61 y ~ x1 + x2 + x3 + x4 + x5 Df Sum of Sq RSS AIC - x5 1 3.747e-06 7.456 -...
2006 Aug 16
1
Specifying Path Model in SEM for CFA
...igure out how to represent the residual errors for the observed variables for a CFA model. (Once I get this working I need to add some further constraints.) Here is what I've tried: model.sa <- specify.model() F1 -> X1,l11, NA F1 -> X2,l21, NA F1 -> X3,l31, NA F1 -> X4,l41, NA F1 -> X5, NA, 0.20 F2 -> X1,l12, NA F2 -> X2,l22, NA F2 -> X3,l32, NA F2 -> X4,l42, NA F2 -> X6, NA, 0.25 F1 <-> F2,g12, 1 F1 <-> F1,g11, 1 F2 <-> F2,g22, 1 X1 <-> X1, NA, 1 X2 <-> X2, NA, 1 X3 <-> X3,...
2005 Apr 22
3
as.data.frame: Error in "names<-.default" (PR#7808)
Hello, I found a potential problem in R 2.1.0 (and R 2.0.1) I expect that > tmp <- FUN(x1, x2, x3, x4) > as.data.frame(tmp) is the same as > as.data.frame(FUN(x1, x2, x3, x4)) since the tmp variable in this case is unnecessary. However, below I will demonstrate that under an odd set of conditions, I can correctly perform as.data.frame(tmp), but not as.data.frame(FUN(x1, x2, x3, x4)). ##...