similar to: plot the dependent variable against one of the predictors with other predictors as constant

Displaying 20 results from an estimated 6000 matches similar to: "plot the dependent variable against one of the predictors with other predictors as constant"

2010 Apr 22
1
Convert character string to top levels + NAN
Dear all, I have several character strings with a high number of different levels. unique(x) gives me values in the range of 100-200. This creates problems as I would like to use them as predictors in a coxph model. I therefore would like to convert each of these strings to a new string (x_new). x_new should be equal to x for the top n categories (i.e. the top n levels with the highest
2011 Mar 12
2
Identifying unique pairs
Dear R helpers Suppose I have a data frame as given below mydat = data.frame(x = c(1,1,1, 2, 2, 2, 2, 2, 5, 5, 6), y = c(10, 10, 10, 8, 8, 8, 7, 7, 2, 2, 4)) mydat         x     y 1      1     10 2      1     10 3      1     10 4      2       8 5      2       8 6      2       8 7      2       7 8      2       7 9      5       2 10    5       2 11    6       4 unique(mydat$x) will give me 1,
2016 Jul 09
2
Red Neuronal complicada categorías
Hola, Esta es una forma de hacerlo... Mira que lo primero que he modificado es el fichero "x.csv" para sustituir los espacios en los nombres por "_". Y también he quitado los acentos y las eñes... He utilizado el paquete RNNS y la función "mlp()" para ajustar la red. #------------------------------------------- > x <- read.csv("x.csv",
2012 Dec 24
1
How to do it through 1 step?
A data set(dat),has 2 variables: x and a, and 100 rows. I wanna add 2 variables,and call the new data set dat1: var1:f = a/median(a) var2:x_new = x*f My solution: dat1<-transform(dat,f = a/median(a),x_new = x*f) But gets error reply which says that "f" is not exits since dat has no variables called "f". So I have to do through 2 steps:
2012 Oct 20
1
rms plot.Predict question: swapping x- and y- axis for categorical predictors
Hello all, I'm trying to plot the effects of variables estimated by a regression model fit individually, and for categorical predictors, the independent variable shows up on the y-axis, with the dependent variable on the x-axis. Is there a way to prevent this reversal? Sample code with dummy data: # make dummy data set.seed(1) x1 <- runif(200) x2 <- sample(c(1,2),200, TRUE) x3 <-
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data for the predictor variable, y=vector of data for the response variable) fit <- smooth.spline(x,y) Now, given a spline fit point y_new, I want to be able to find out what value of x_new yielded this fit value. How to do so? (This problem is the inverse of the predict.smooth.spline function, which takes x_new as input
2012 Jul 05
2
Plotting the probability curve from a logit model with 10 predictors
I have a logit model with about 10 predictors and I am trying to plot the probability curve for the model. Y=1 = 1 / 1+e^-z where z=B0 + B1X1 + ... + BnXi If the model had only one predictor, I know to do something like below. mod1 = glm(factor(won) ~ as.numeric(bid), data=mydat, family=binomial(link="logit")) all.x <- expand.grid(won=unique(won), bid=unique(bid)) y.hat.new
2012 Apr 11
1
inference for customized regression in R?
Hi all, Are there functions in R that could help me do the following? We have a special type of regression which is called Geometric Mean Regression. We have done some search and found the following: https://stat.ethz.ch/pipermail/r-help/2011-July/285022.html The question is: how to do the statistical inference on GMR results? More specifically, we are looking for the prediction interval:
2012 Dec 18
2
Set a zero at minimum row by group
Dear R Helpers, I'm struggling with a data preparation problem. I feel that it is a quite easy task but I don't get it done. I hope you can help me with that. I have a data frame looking like this: ID <- c(1,1,1,2,2,3,3,3,3) T <- c(1,2,3,1,4,3,5,6,8) x <- rep(1,9) df <- data.frame(ID,T,x) >df ID T x 1 1 1 1 2 1 1 3 1 2 1 1 2 4 1 3 3 1 3 5 1 3 6 1 3 8 1 I want to
2012 Feb 21
0
BHHH algorithm on duration time models for stock prices
I am currently trying to find MLE of a function with four parameters. My codes run well but i don't get the results. I get the following message: BHHH maximisation Number of iterations: 0 Return code: 100 Initial value out of range. I don't know this is so because of the way i have written my loglikelihood or what. The loglikelihood LogLik<-function(param){ beta_1<-param[1]
2008 Apr 17
1
Error in Design package: dataset not found for options(datadist)
Hi, Design isn't strictly an R base package, but maybe someone can explain the following. When lrm is called within a function, it can't find the dataset dd: > library(Design) > age <- rnorm(30, 50, 10) > cholesterol <- rnorm(30, 200, 25) > ch <- cut2(cholesterol, g=5, levels.mean=TRUE) > fit <- function(ch, age) + { + d <- data.frame(ch, age) +
2008 May 29
2
Troubles plotting lrm output in Design Library
Dear R-helpers, I'm having a problem in using plot.design in Design Library. Tho following example code produce the error: > n <- 1000 # define sample size > set.seed(17) # so can reproduce the results > age <- rnorm(n, 50, 10) > blood.pressure <- rnorm(n, 120, 15) > cholesterol <- rnorm(n, 200, 25) > sex <-
2010 Mar 02
2
ANOVA "Types" and Regression models: the same?
Hello, I think I am beginning to understand what is involved in the so-called "Type-I, II, ..." ANOVAS (thanks to all the replies I got for yesterday's post). I have a question that will help me (and others?) understand it better (or remove a misunderstanding): I know that ANOVA is really a special case of regression where the predictor variable is categorical. I know that there
2016 Jul 07
2
Red Neuronal complicada categorías
Estimados Les consulto por redes neuronales, hay diversos artículos como los siguientes (el último tienen un error actualmente). Pero mi pregunta va un poco por otro lado. http://www.r-bloggers.com/build-your-own-neural-network-classifier-in-r/ http://www.r-bloggers.com/classification-using-neural-net-in-r/ Básicamente se puede calcular un valor, por ejemplo doblar 2,4 grados a la derecha, luego 1
2011 May 05
7
Draw a nomogram after glm
Hi all R users I did a logistic regression with my binary variable Y (0/1) and 2 explanatory variables. Now I try to draw my nomogram with predictive value. I visited the help of R but I have problem to understand well the example. When I use glm fonction, I have a problem, thus I use lrm. My code is: modele<-lrm(Y~L+P,data=donnee) fun<- function(x) plogis(x-modele$coef[1]+modele$coef[2])
2009 Sep 08
2
Very basic question regarding plot.Design...
Hello ALL! I have a problem to plot factor (lets say gender) as a line, or at least both line and point, from ols model: ols1 <- ols(Y ~ gender, data=dat, x=T, y=T) plot(ols1, gender=NA, xlab="gender", ylab="Y", ylim=c(5,30), conf.int=FALSE) If I convert gender into discrete numeric predictor, and use forceLines=TRUE, plot is not nice and true, since it shows values
2004 Apr 09
2
Regression models w/ splines
Hi - I am fitting various Cox PH models with spline predictors. After fitting the model, I would like to use termplot() to examine the functional form of the fitted model (e.g., to obtain a plot of the relative risk (or log r.r.) versus the predictors). When there is only 1 predictor in the model, termplot returns a "?". In this case, I have not been able to figure out how to create
2012 Sep 11
1
Plotting every probability curve
I don't have a logistic regression model and am trying to generate probability curves for all possible combinations of the variables. My logit model has 5+ variables, and I want to draw curves for every scenario. See code below. When home_owner is 0 and 1, I want curves. The same goes for all other variables categories, so that I have permutations for all possible combinations. I've
2008 Apr 03
1
Design package lrm summary and factors
Hello, I have question regarding the lrm function and estimating the odds ratio between different levels of a factored variable. The following code example illustrates the problem I am having. I have a data set with an outcome variable (0,1) and an input variable (A,B,C). I would like to estimate the effect of C vs B, but when I perform the summary I only get A vs B and A vs C, even though I
2009 Jul 12
0
Plotting problem [lars()/elasticnet()]
Dear all, I am using modified LARS algorithm (ref: The Adaptive Lasso and Its Oracle Properties, Zou 2006) for adaptive lasso penalized linear regression. 1. w(j) <- |beta_ols(j)|^(-gamma) gamma>0 and j = 1,...,p 2. define x_new(j) <- x(j)*w(j) 3. apply LARS to solve modified lasso problem out.adalasso <- lars(X_new,y,type="lasso") or enet(X_new,