Displaying 20 results from an estimated 64 matches for "xvars".
Did you mean:
vars
2007 Jun 14
4
question about formula for lm
Dear all;
Is there any way to make this to work?:
.x<-rnorm(50,10,3)
.y<-.x+rnorm(50,0,1)
X<-data.frame(.x,.y)
colnames(X)<-c("Xvar","Yvar")
Ytext<-"Yvar"
lm(Ytext~Xvar,data=X) # doesn't run
lm(Yvar~Xvar,data=X) # does run
The main idea is to use Ytext as input in a function, so you just type
"Yvar" and the model should fit....
2005 Jul 05
1
by (tapply) and for loop differences
I am getting a difference in results when running some analysis using by and
tapply compare to using a for loop. I've tried searching the web but had no
luck with the keywords I used.
I've attached a simple example below to illustrates my problem. I get a
difference in the mean of yvar, diff and the p-value using tapply & by
compared to a for loop. I cannot see what I am doing wrong.
2003 Jan 22
1
something wrong when using pspline in clogit?
Dear R users:
I am not entirely convinced that clogit gives me the correct result when I
use pspline() and maybe you could help correct me here.
When I add a constant to my covariate I expect only the intercept to change,
but not the coefficients. This is true (in clogit) when I assume a linear in
the logit model, but the same does not happen when I use pspline().
If I did something similar
2011 Feb 25
1
speed up process
Dear users,
I have a double for loop that does exactly what I want, but is quite
slow. It is not so much with this simplified example, but IRL it is slow.
Can anyone help me improve it?
The data and code for foo_reg() are available at the end of the email; I
preferred going directly into the problematic part.
Here is the code (I tried to simplify it but I cannot do it too much or
else it
2012 Aug 11
1
using eval to handle column names in function calling scatterplot graph function
I am running R version 2.15.1 in Windows XP
I am having problems with a function I'm trying to create to:
1. subset a data.frame based on function arguments (colname & parmname)
2. rename the PARMVALUE column in the data.frame based on function
argument (xvar)
3. generate charts
plotvar <- function(parentdf,colname, parmname,xvar,yvar ){
subdf <-
2019 May 25
3
Increasing number of observations worsen the regression model
I have the following code:
```
rm(list=ls())
N = 30000
xvar <- runif(N, -10, 10)
e <- rnorm(N, mean=0, sd=1)
yvar <- 1 + 2*xvar + e
plot(xvar,yvar)
lmMod <- lm(yvar~xvar)
print(summary(lmMod))
domain <- seq(min(xvar), max(xvar))??? # define a vector of x values to
feed into model
lines(domain, predict(lmMod, newdata = data.frame(xvar=domain)))??? #
add regression line, using
2009 Apr 21
6
Sampling in R
[This email is either empty or too large to be displayed at this time]
2007 Nov 15
1
Writing a helper function that takes in the dataframe and variable names and then does a subset and plot
Hi,
I have a large dataframe than I'm writing functions to explore, and to
reduce cut and paste I'm trying to write a function that does a subset
and then a plot.
Firstly, I can write a wrapper around a plot:
plotwithfits <- function(formula, data, xylabels=c('','')) {
xyplot(formula, data, panel =
function(x,y, ...) {
panel.xyplot(x,y,
2011 Apr 01
3
programming: telling a function where to look for the entered variables
Hi there,
Could someone help me with the following programming problem..?
I have written a function that works for my intended purpose, but it
is quite closely tied to a particular dataframe and the names of the
variables in this dataframe. However, I'd like to use the same
function for different dataframes and variables. My problem is that
I'm not quite sure how to tell my function in
2011 Mar 05
2
please help ! label selected data points in huge number of data points potentially as high as 50, 000 !
Dear All
I am reposting because I my problem is real issue and I have been working on
this. I know this might be simple to those who know it ! Anyway I need help
!
Let me clear my point. I have huge number of datapoints plotted using either
base plot function or xyplot in lattice (I have preference to use lattice).
name xvar p
1 M1 1 0.107983837
2 M2 11
2011 Aug 30
1
R crash
Dear users,
By running the script below, R crashes systematically at the last
command, namely dev.off(), on Windows 7, but not on Windows XP.
I therefore don't provide a reproducible example and do not really
extract the relevant parts of the script because it has most likely
nothing to do with the script itself. I can do it though if you think it
might be relevant.
R crashes on Windows
2011 Feb 28
0
Fwd: Re: speed up process
Dear Jim,
Here is again exactly what I did and with the output of Rprof (with this
reduced dataset and with a simpler function, it is here much faster than
in real life).
Thanks you again for your help!
## CODE ##
mydata1<- structure(list(species = structure(1:8, .Label =
c("alsen","gogor", "loalb", "mafas", "pacyn", "patro",
2005 Dec 26
4
lme X lmer results
Hi,
this is not a new doubt, but is a doubt that I cant find a good response.
Look this output:
> m.lme <- lme(Yvar~Xvar,random=~1|Plot1/Plot2/Plot3)
> anova(m.lme)
numDF denDF F-value p-value
(Intercept) 1 860 210.2457 <.0001
Xvar 1 2 1.2352 0.3821
> summary(m.lme)
Linear mixed-effects model fit by REML
Data: NULL
AIC BIC
2012 Sep 20
1
Gummy Variable : Doubt
Hi,
I have a system in which I analyze 2 subjects and 1 variable, so I have
2 models as follow:
y ~ x_1[, 1] + x_2[, 1] + x_1[, 2] + x_2[, 2]
Where
x_1[, i] = cos(2 * pi * t / T_i)
x_2[, i] = sin(2 * pi * t / T_i)
i = 1, 2
Data have two columns: t and y.
As you can see, I have a multiple components model, with rithm and
without trends, and I have a fundamental
2011 Oct 12
2
Nonlinear regression aborting due to error
Colleagues,
I am fitting an Emax model using nls. The code is:
START <- list(EMAX=INITEMAX, EFFECT=INITEFFECT, C50=INITC50)
CONTROL <- list(maxiter=1000, warnOnly=T)
#FORMULA <- as.formula(YVAR ~ EMAX - EFFECT * XVAR^GAMMA / (XVAR^GAMMA + C50^GAMMA)) ## alternate version of formula
FORMULA <- as.formula(YVAR ~ EMAX - EFFECT / (1 + (C50/XVAR)^GAMMA))
FIT <-
2011 Mar 05
1
displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function
Dear R users,
Here is my problem:
# example data
name <- c(paste ("M", 1:1000, sep = ""))
xvar <- seq(1, 10000, 10)
set.seed(134)
p <- rnorm(1000, 0.15,0.05)
dataf <- data.frame(name,xvar, p)
plot (dataf$xvar,p)
abline(h=0.05)
# I can know which observation number is less than 0.05
which (dataf$p < 0.05)
[1] 12 20 80 269 272 338 366 368 397 403 432 453
2007 May 23
1
name of object in quotes
I am writing a function in which, at some point, I to recuperate the
name of a previous object in quotes. I am currently using the function
Cs() from the Hmisc library but the result is:
foo <- function(xvar) {
variable <- Cs(xvar)
return(variable)
}
foo(x1)
> "xvar"
when I would expected to obtain "x1".
Any suggestion?
Thanks
--
*Gonzalo Rivero*
Ph.D.
2009 Feb 27
1
Sweave doesn't do csv.get()
Hi Everybody
I use R2.8.0 on Mac OS X. I set up LyX 1.6.1 to use Sweave today. I can
compile the test file I found on CRAN (
http://cran.r-project.org/contrib/extra/lyx/) without a problem and the
output looks very nice. In the test file the following R code is used.
<<myFirstChunkInLyX>>=
xObs <- 100; xMean <- 10; xVar <- 9
x <- rnorm(n=xObs, mean=xMean, sd=sqrt(xVar))
2011 Apr 30
1
More flexible aggregate / eval
Dear list,
I would like to do some calculation using different grouping variables.
My 'df' looks like this:
# Some data
set.seed(345)
id <- seq(200,400, by=10)
ids <- sample(substr(id,1,1))
group1 <- rep(1:3, each=7)
group2 <- rep(1:2, c(10,11))
group3 <- rep(1:4, c(5,5,5,6))
df <- data.frame(id, ids, group1, group2, group3)
df <- rbind(df, df, df)
df$time <-
2012 Jun 25
3
Loop for multiple plots in figure
Hello, I have longitudinal data of the form below from N subjects; I am
trying to create figure with N small subplots on a single page, in which
each plot is from only one subject, and in each plot there is a separate
curve for each value of param1.
So in this case, there would be four plots on the page (one each for Bob,
Steve, Kevin and Dave), and each plot would have two separate curves (one