similar to: Modelling

Displaying 20 results from an estimated 20000 matches similar to: "Modelling"

2009 Sep 25
1
Binomial
Dear R-users, Suppose I have the following sample of data, 0 1 2 4 3 1 2 1 3 1 1 3 3 4 1 0 1 2 1 2 1 4 1 4 2 1 2 2 1 1 The first variable is the response variable where 0 is defective and 1 normal. The other four factors( x1,x2,x3,x4) that influence the outcome. I want to fit a binomial model . How do I do that? I am guessing the response variable
2017 Dec 09
1
Remove
library(dplyr) DM <- read.table( text='GR x y A 25 125 A 23 135 . . . ) DM %>% filter((GR == "A" & (x >= 15) & (x <= 30)) | (GR == "B" & (x >= 40) & (x <= 50)) | (GR == "C" & (x >= 60) & (x <= 75))) On Fri, Dec 8, 2017 at 4:48 PM, Ashta <sewashm at gmail.com>
2017 Dec 09
1
Remove
Hello, Try the following. keep <- list(A = c(15, 30), B = c(40, 50), C = c(60, 75)) sp <- split(DM$x, DM$GR) inx <- unlist(lapply(seq_along(sp), function(i) keep[[i]][1] <= sp[[i]] & sp[[i]] <= keep[[i]][2])) DM[inx, ] # GR x y #1 A 25 125 #2 A 23 135 #5 B 45 321 #6 B 47 512 #9 C 61 521 #10 C 68 235 Hope this helps, Rui Barradas On 12/9/2017 12:48 AM, Ashta
2017 Dec 09
0
Remove
> On Dec 8, 2017, at 6:16 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > >> On Dec 8, 2017, at 4:48 PM, Ashta <sewashm at gmail.com> wrote: >> >> Hi David, Ista and all, >> >> I have one related question Within one group I want to keep records >> conditionally. >> example within >> group A I want keep rows that
2017 Dec 09
2
Remove
> On Dec 8, 2017, at 4:48 PM, Ashta <sewashm at gmail.com> wrote: > > Hi David, Ista and all, > > I have one related question Within one group I want to keep records > conditionally. > example within > group A I want keep rows that have " x" values ranged between 15 and 30. > group B I want keep rows that have " x" values ranged
2017 Dec 07
0
Remove
Thank you Ista! Worked fine. On Wed, Dec 6, 2017 at 5:59 PM, Ista Zahn <istazahn at gmail.com> wrote: > Hi Ashta, > > There are many ways to do it. Here is one: > > vars <- sapply(split(DM$x, DM$GR), var) > DM[DM$GR %in% names(vars[vars > 0]), ] > > Best > Ista > > On Wed, Dec 6, 2017 at 6:58 PM, Ashta <sewashm at gmail.com> wrote: >> Thank
2017 Dec 06
2
Remove
Hi Ashta, There are many ways to do it. Here is one: vars <- sapply(split(DM$x, DM$GR), var) DM[DM$GR %in% names(vars[vars > 0]), ] Best Ista On Wed, Dec 6, 2017 at 6:58 PM, Ashta <sewashm at gmail.com> wrote: > Thank you Jeff, > > subset( DM, "B" != x ), this works if I know the group only. > But if I don't know that group in this case "B", how
2017 Dec 09
1
Remove
You could make numeric vectors, named by the group identifier, of the contraints and subscript it by group name: > DM <- read.table( text='GR x y + A 25 125 + A 23 135 + A 14 145 + A 35 230 + B 45 321 + B 47 512 + B 53 123 + B 55 451 + C 61 521 + C 68 235 + C 85 258 + C 80 654',header = TRUE, stringsAsFactors = FALSE) > > GRmin <- c(A=15, B=40, C=60) > GRmax <-
2008 Mar 12
1
[follow-up] "Longitudinal" with binary covariates and outcome
Hi again! Following up my previous posting below (to which no response as yet), I have located a report which situates this type of question in a longitudinal modelling context. http://www4.stat.ncsu.edu/~dzhang2/paper/glm.ps Generalized Linear Models with Longitudinal Covariates Daowen Zhang & Xihong Lin (This work seems to originally date from around 1999). They consider an outcome Y,
2017 Dec 09
0
Remove
Hi David, Ista and all, I have one related question Within one group I want to keep records conditionally. example within group A I want keep rows that have " x" values ranged between 15 and 30. group B I want keep rows that have " x" values ranged between 40 and 50. group C I want keep rows that have " x" values ranged between 60 and 75. DM <-
2018 Mar 28
0
coxme in R underestimates variance of random effect, when random effect is on observation level
Hello, I have a question concerning fitting a cox model with a random intercept, also known as a frailty model. I am using both the coxme package, and the frailty statement in coxph. Often 'shared' frailty models are implemented in practice, to group people who are from a cluster to account for homogeneity in outcomes for people from the same cluster. I am more interested in the classic
2016 Apr 26
0
Predicting probabilities in ordinal probit analysis in R
Dear all, I have two questions that are almost completely related to how to do things in R. I am running an ordinal probit regression analysis in R. The dependent variable has three levels (0=no action; 1=warning; 2=sanction). I use the lrm command in the rms package: print( res1<- lrm(Y ~ x1+x2+x3+x4+x5+x6, y=TRUE, x=TRUE, data=mydata)) I simply couldn't make any sense of the
2017 Dec 07
4
Remove
> On Dec 6, 2017, at 4:27 PM, Ashta <sewashm at gmail.com> wrote: > > Thank you Ista! Worked fine. Here's another (possibly more direct in its logic?): DM[ !ave(DM$x, DM$GR, FUN= function(x) {!length(unique(x))==1}), ] GR x y 5 B 25 321 6 B 25 512 7 B 25 123 8 B 25 451 -- David > On Wed, Dec 6, 2017 at 5:59 PM, Ista Zahn <istazahn at gmail.com> wrote:
2009 Jun 02
0
Conducting data modelling on weighted data using R
Hello, I am starting to use R for various analyses, for example I use the ca package to do Correspondence Analysis. I am also looking to use packages such as: pls Partial Least Squares plspm Partial Least Squares Path Modelling However, although I can use packages such as these on un-weighted data there does not appear to be a facility to take account of weighted data. I am a
2009 Oct 01
4
Color of graph
I am trying to plot a line graph for 3 or more regression lines abline(m1) abline(m2) abline(m3) Can I change the color of each line? if so how? Thanks in advance Ashta [[alternative HTML version deleted]]
2008 Dec 10
1
Stepwise regression
Hi, I have the response variable 'Y' and four predictors say X1, X2, X3 and X4. Assuming all the assmptions like Y follows normal distribution etc. hold and I want to run linear multiple regression. How do I run the stepwise regression (forward as well as the backward regression). >From other software (i.e. minitab), I know only X1 and X2 are significant so my regression equation
2008 Aug 01
5
drop1() seems to give unexpected results compare to anova()
Dear all, I have been trying to investigate the behaviour of different weights in weighted regression for a dataset with lots of missing data. As a start I simulated some data using the following: library(MASS) N <- 200 sigma <- matrix(c(1, .5, .5, 1), nrow = 2) sim.set <- as.data.frame(mvrnorm(N, c(0, 0), sigma)) colnames(sim.set) <- c('x1', 'x2') # x1 & x2 are
2001 Jun 07
3
Diag "Hat" matrix
Hi R users: What is the difference between in the computation of the diag of the "hat" matrix in: "lm.influence" and the matrix operations with "solve()" and "t()"? I mean, this is my X matrix x1 x2 x3 x4 x5 [1,] 0.297 0.310 0.290 0.220 0.1560 [2,] 0.360 0.390 0.369 0.297 0.2050 [3,] 0.075 0.058 0.047 0.034 0.0230 [4,] 0.114 0.100
2008 Mar 11
0
"Longitudinal" with binary covariates and outcome
Hi Folks, I'd be grateful for suggestions about approaching the following kind of data. I'm not sure what general class of models it is best situated in (that's just my ignorance), and in particular if anyone could point me to case studies associated with an R approach that would be most useful. Suppose I have data of the following kind. Each "subject" is observed at say 4
2017 Dec 06
0
Remove
Thank you Jeff, subset( DM, "B" != x ), this works if I know the group only. But if I don't know that group in this case "B", how do I identify group(s) that all elements of x have the same value? On Wed, Dec 6, 2017 at 5:48 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > subset( DM, "B" != x ) > > This is covered in the Introduction to