similar to: Loop in columns by group

Displaying 20 results from an estimated 10000 matches similar to: "Loop in columns by group"

2010 Oct 07
3
quantile regression
Dear all, I am a new user in r and I am facing some problems with the quantile regression specification. I have two matrix (mresultb and mresultx) with nrow=1000 and ncol=nsim, where I specify (let's say) nsim=10. Hence, the columns in my matrix represents each simulation of a determined variable. I need to regress each column of mresultb on mresultx. My codes are the following:
2011 Nov 26
1
Constrained linear regression
Dear all, I need to run a simple linear regression such that: y = b0 + b1*x1 + (1-b1)*x2 + e which I know I can use: lm(y ~ I(x1 - x2) + offset(x2)). However, I also need to restrict the coefficient b1 to be between 0 and 1. Is there any way to include such restriction in the linear regression estimation? I saw suggestion related with the function Solve.QP, but I really did not understand such
2011 Dec 05
1
extract cov matrix in summary.rq and use as a matrix.
Dear all, I need to extract the covariance matrix of my quantile regression estimation to use in a test. My regression is: qf2_1 <- summary(rq(wb2 ~ apv2 + vol2, tau = phi2[1]), cov = TRUE) I can extract the covaraince matrix by using: qf2_1 [3]. However, if I try to use it in the test, it does not work. I only need to transform qf2_1[3] in a matrix 3x3. I have already tried:
2010 Oct 06
4
loop in R
Dear all, I need to do a loop in R, but I am not sure the software is generating "n" times the variables I request differently. When I ask to print the last matrix created, I just can see the loop for n=1. To be more precise, supose I need to simulate 10 times one variable and I want to fit the 10 variables simulated in a matrix. I dont really know what I am doing wrong, but I just
2010 Oct 13
1
(no subject)
Dear all, I have just sent an email with my problem, but I think no one can see the red part, beacuse it is black. So, i am writing again the codes: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- matrix(-99, nrow=1000, ncol=nsim) N <- 200 I <- 5 taus <- c(0.480:0.520) h <-
2005 Jun 24
1
lme4 extracting individual variance components
Hi, For further calculations I need to extract indivdual Variances of different random effects from a fitted model. I found out how to extract the correlations (VarCorr(m1)@reSumry$group1) but I was not able to find a way to extract the other components individually. To extract the Residuals I tried: (ranef(m1)@ stdErr) which unfortunately did not work. Thank you very much for your help!
2011 Oct 16
1
nlrq {quantreg}
Dear all, I sent an email on Friday asking about nlrq {quantreg}, but I haven't received any answer. I need to estimate the quantile regression estimators of a model as: y = exp(b0+x'b1+u). The model is nonlinear in parameters, although I can linearise it by using log.When I write: fitnl <- nlrq(y ~ exp(x), tau=0.5) I have the following error: Error in match.call(func, call = cll) :
2011 Nov 19
1
wald test: compare quantile regression estimators from different samples
Dear all, I am trying to compare the estimated coefficients of a quantile regression model between two different samples. It is a Wald test, but I cannot find one way to do that in R.The samples are collected conditional on a specific characteristic and I would like to test whether such characteristic indeed affect the estimators. The problem in the test anova.rq is that the response variable
2011 Nov 05
2
linear against nonlinear alternatives - quantile regression
Dear all, I would like to know whether any specification test for linear against nonlinear model hypothesis has been implemented in R using the quantreg package. I could read papers concerning this issue, but they haven't been implemented at R. As far as I know, we only have two specification tests in this line: anova.rq and Khmaladze.test. The first one test equality and significance of
2008 Jun 18
1
operations on all pairs of columns from two matrices
m1 <- matrix(rnorm(40), ncol=4) m2 <- matrix(rnorm(40), ncol=4) I would like to subtract first column of m1 from all columns of m2, subtract 2nd of m1 from all columns of m2, and so on. Obviously, I am not using the appropriate function outer(m1, m1, "-"), since the first column isn't all 0s. _________________________________________________________________
2005 Sep 22
3
anova on binomial LMER objects
Dear R users, I have been having problems getting believable estimates from anova on a model fit from lmer. I get the impression that F is being greatly underestimated, as can be seen by running the example I have given below. First an explanation of what I'm trying to do. I am trying to fit a glmm with binomial errors to some data. The experiment involves 10 shadehouses, divided between
2011 Apr 13
2
setting pairwise comparisons of columns
Hi, I have a number of genes (columns) for which I want to examine pairwise associations of genotypes (each row is an individual)...For example (see data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e. does ac from M1 tend to be found with bc from M2 more often than expected.) Down stream I will be performing chi square tests for each pair. But I am looking for a way to
2010 Oct 13
4
loop
Dear all, I am trying to run a loop in my codes, but the software returns an error: "subscript out of bounds" I dont understand exactly why this is happenning. My codes are the following: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- matrix(-99, nrow=1000, ncol=nsim) N
2009 Jul 03
2
bigglm() results different from glm()
Hi Sir, Thanks for making package available to us. I am facing few problems if you can give some hints: Problem-1: The model summary and residual deviance matched (in the mail below) but I didn't understand why AIC is still different. > AIC(m1) [1] 532965 > AIC(m1big_longer) [1] 101442.9 Problem-2: chunksize argument is there in bigglm but not in biglm, consequently,
2008 Nov 25
1
compute pearson correlation p-values for all combinations of columns of 2 matrices
How can I compute the pearson correlation p-values for all combinations of columns of 2 matrices ? > m <- matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) > m1 <- matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) > cor(m,m1) a b c d e a -0.67533294 -0.2516151 -0.3780815 0.55816011
2009 Sep 11
1
help in matching two column vectors
Dear list, I have a long list of two vectors with some matching elements. I would like to line them up in two columns and have an NA in those positions of the second vector where a match is absent. With a simple example, I will explain my problem. (a<-1:6) (b<-c(5,2)) (m1<-match(a,b)) (ab<-cbind(a,m1)) m2<-numeric(length(m1)) for (i in 1:length(m1))
2009 Jun 11
1
formula for degrees of freedom for nonlinear mixed model in nlme
Dear forum members, What is the formula to calculate denominator degrees of freedom (den df) for nonlinear mixed-effect models with covariates? My model is similar to a CO2 uptake example from Pinheiro and Bates (2000, page 376). In this CO2 dataset, there are two treatments and two types (84 observations in total), but den df for each parameter of the model is 64. Isn’t it too high? Your
2018 Sep 26
2
as.vector() broken on a matrix or array of type "list"
Hi, Unlike on an atomic matrix, as.vector() doesn't drop the "dim" attribute of matrix or array of type "list": m <- matrix(list(), nrow=2, ncol=3) m # [,1] [,2] [,3] # [1,] NULL NULL NULL # [2,] NULL NULL NULL as.vector(m) # [,1] [,2] [,3] # [1,] NULL NULL NULL # [2,] NULL NULL NULL is.vector(as.vector(m)) # [1] FALSE
2011 Nov 08
3
Reading a specific column of a csv file in a loop
Dear all: I have two larges files with 2000 columns. For each file I am performing a loop to extract the "i"th element of each file and create a data frame with both "i"th elements in order to perform further analysis. I am not extracting all the "i"th elements but only certain which I am indicating on a vector called "d". See an example of my code below
2011 Dec 20
1
column permutation of sparse matrix
Hi, I'm very new to working with sparse matrices and would like to know how I can column permute a sparse matrix. Here is a small example: > M1 <- > spMatrix(nrow=5,ncol=6,i=sample(5,15,replace=TRUE),j=sample(6,15,replace=TRUE),x=round_any(rnorm(15,2),0.001)) > M1 5 x 6 sparse Matrix of class "dgTMatrix" [1,] 2.983 . 1.656 5.003 . . [2,] .