similar to: missing level of a nested factor results in an NA in lm output

Displaying 19 results from an estimated 19 matches similar to: "missing level of a nested factor results in an NA in lm output"

2011 Dec 07
2
plotting and coloring longitudinal data with three time points (ggplot2)
Dear list, I have been struggling with this for some time now, and for the last hour I have been struggling to make a working example for the list. I hope someone out there have some experience with plotting longitudinal data that they will share. My data is some patient data with three different time stamps. First the patients are identified at different times (first time stamp). Second, they
2010 Jun 18
2
help with reshape is needed again!
hi, folks: i need to transpose the following data: gene tissue patient1 patient2 patient3..... --------------------------------------------- gene1 breast 10 100 1 gene2 breast 20 200 4 gene3 breast 30 50 5 gene4 breast 40 400 9 ................................ to the
2002 Aug 08
1
The unary - operator and matrix column labels
I am making some changes to the permax library (so that it will accept NA's). This function performs a permutation analysis to identify discriminating attributes distinguishing two groups of observations. It takes the form (at its most simplistic): permax(data, ig1) where ig1 is one group of interest. The other group (if not specified) is assumed to be the remaining observations, namely,
2010 Jun 17
2
help for reshape function
hi, everyone: i have a question on the reshape function. i have the following dataset : gene tissue patient1 patient2 patient3............. _________________________________________________ gene1 breast 10 20 50 gene2 breast 20 40 60 gene3 breast 100 200 300 which i hope to convert to the following format: gene patientID
2009 Sep 18
0
missing values at a combination of two factors
Dear All, I have two factors: GROUP and PATIENT, where PATIENT is nested within GROUP. >levels(example$GROUP) [1] "0" "1" "2" "3" "4" > levels(example$PATIENT) [1] "1" "2" "3" There are three observations at each combination of these factors. However, there are no observations for PATIENT = 3 and GROUP
2017 Dec 02
0
How can you find the optimal number of values to randomly sample to optimize random forest classification without trial and error?
I have data set up like the following: control1 <- sample(1:75, 3947398, replace=TRUE) control2 <- sample(1:75, 28793, replace=TRUE) control3 <- sample(1:100, 392733, replace=TRUE) control4 <- sample(1:75, 858383, replace=TRUE) patient1 <- sample(1:100, 28048, replace=TRUE) patient2 <- sample(1:50, 80400, replace=TRUE) patient3 <- sample(1:100, 48239, replace=TRUE) control
2008 Dec 05
1
complex(?) reshaping question
Hello, I have a problem with data reshaping. Here's my data DF <- structure(list(idvar1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("patient1", "patient2" ), class = "factor"), idvar2 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("dob", "hog"), class =
2009 Jun 23
2
Partitioning matrix
Let say, I have following matrix : dat <- matrix(rnorm(40), 2, 20) Now I want to partition this like this : dat1 <- dat[1,] dat2 <- dat[2,] But point is that, dat1 and dat2 become vector object. How can I force them to be matrix object with dimension (1x20) ? Thanks, -- View this message in context: http://www.nabble.com/Partitioning-matrix-tp24161021p24161021.html Sent from the R
2012 Sep 07
2
Contrasts for 2x4 interaction in mixed effects model
Hello everyone, I am running a mixed effects model where I have two fixed factors, one with 2 levels and one with 4, and their interaction. Let's say these are my factors and their levels: FirstFactor: 1, 2 SecondFactor: A, B, C, D For the interaction, I am interested in the four two-way comparisons, not the two four-way comparisons. In other words, I want to test whether 1A is
2009 Sep 28
1
plot error -- figure margins too large
Hi, I am trying to plot my dataset, consisting of one column with numeric values and one column with group IDs. The set is similar to the following df. df <- NULL for ( i in 1:20) { tmp1 <- runif(1000,0,5) tmp2 <- cbind(tmp1,i) df <- rbind(df,tmp2) } Now I would like to plot the numeric column, stratified by the group IDs, in a single figure. First, I partitioned the frame
2010 Jun 18
1
12th Root of a Square (Transition) Matrix
Dear R-tisans, I am trying to calculate the 12th root of a transition (square) matrix, but can't seem to obtain an accurate result. I realize that this post is laced with intimations of quantitative finance, but the question is both R-related and broadly mathematical. That said, I'm happy to post this to R-SIG-Finance if I've erred in posting this to the general list. I've
2013 Jan 06
0
fPortfolio-portfolio optimization
Hello everyone, I have been spending many hours on a seemingly simple portfolio optimization problem using the package fPortfolio. My optimization problem is slightly different than a standard one such that I have a known set of asset returns. My problem is how to collect this information into my functions and pass them onto the optimization function. I have written my own covariance estimation
2018 Jan 05
0
Calculating the correlations of nested random effects in lme4
I postulate the following model AC <- glmer(Accuracy ~ RT*Group + (1+RT|Group:subject) + (1+RT|Group:Trial), data = da, family = binomial, verbose = T) Here I predict Accuracy from RT, Group (which has values 0 or 1) and the interaction of Group and RT (those are the fixed effects). I also estimate the random effects for both intercepts and slopes for subjects and different trials.
2023 Aug 06
2
Stacking matrix columns
I wish to stack columns of a matrix into one column. The following matrix command does it. Any other ways? Thanks. > x<-matrix(1:20,5,4) > x ???? [,1] [,2] [,3] [,4] [1,]??? 1??? 6?? 11?? 16 [2,]??? 2??? 7?? 12?? 17 [3,]??? 3??? 8?? 13?? 18 [4,]??? 4??? 9?? 14?? 19 [5,]??? 5?? 10?? 15?? 20 > matrix(x,ncol=1) ????? [,1] ?[1,]??? 1 ?[2,]??? 2 ?[3,]??? 3 ?[4,]??? 4 ?[5,]??? 5
2011 Oct 17
2
how to use 'which' inside of 'apply'?
Hello R-community, I am trying to populate a column (doy) in a large dataset with the first column number that exceeds the value in another column (thold) using the 'apply' function. Sample data: pt D1 D17 D33 D49 D65 D81 D97 D113 D129 D145 D161 D177 D193 D209 D225 D241 D257 1 39177 0 0 0 0 0 0 0 0 0.4336 0.4754 0.5340667 0.5927334 0.6514 0.6966
2012 Nov 19
1
Help: Meta-analysis with metacor
Trying to do a meta-analysis of correlations in R using the meta package; have tried several things and keep getting a similar error. Can anyone help explain the error? > cor<-c(-0.3018, 0.667, -3.8002, -0.607, -0.4885, -3.8002, -0.0701, 0.1348, -0.9505, -0.5709, -0.6127, -1.2419, -0.1511, -0.1054)> n<-c(3,4,3,3,3,3,16,36,30,9,3,3,30,4)> library(meta)> metacor(cor, n, data=NULL,
2004 Aug 27
1
ANCOVA
Dear R-help list, I am attempting to understand the proper formulation of ANCOVA's in R. I would like to test both parallelism and intercept equality for some data sets, so I have generated an artificial data set to ease my understanding. This is what I have done #Limits of random error added to vectors min <- -0.1 max <- 0.1 x <- c(c(1:10), c(1:10))+runif(20, min, max) x1 <-
2006 Oct 08
2
latex and anova.lme problem
Dear R-helpers, When I try > anova(txtE2.lme, txtE2.lme1) Model df AIC BIC logLik Test L.Ratio p-value txtE2.lme 1 10 8590 8638 -4285 txtE2.lme1 2 7 8591 8624 -4288 1 vs 2 6.79 0.0789 > latex(anova(txtE2.lme, txtE2.lme1)) Error: object "n.group" not found I don't even see n.group as one of the arguments of latex() I checked to see >
2012 Jul 06
4
differences between survival models between STATA and R
Dear Community, I have been using two types of survival programs to analyse a data set. The first one is an R function called aftreg. The second one an STATA function called streg. Both of them include the same analyisis with a weibull distribution. Yet, results are very different. Shouldn't the results be the same? Kind regards, J -- View this message in context: