Displaying 20 results from an estimated 4000 matches similar to: "question about formula for lm"
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.
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 <-
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 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
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
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 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
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
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
2008 Nov 15
1
Lattice: groups and no groups with panel.superpose
Dear R listers,
I am trying to create a lattice plot with independent regression lines per group
for each panel, plus one overall regression line per panel. I succeed in having
the separate regression lines for each group per panel, but I can't figure out
how to add the overall regression line over all groups. I have learnt a lot from
the list, but I can't find an example for what I want
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 Aug 24
1
Scatter plots, linear regression in ggplot2
Hi,
Based on some modification that I did to the R Cookbook Graphs Scatterplots
code, link:http://wiki.stdout.org/rcookbook/Graphs/Scatterplots%20(ggplot2)
I have some questions and I will appreciate a help:
- How do I change the legend title?
- How can I change the for each linear regression its color and linetype?
- How can I add for both the linear regression lines their equations and
Rseq
2005 Dec 31
1
xy.coords
In ?xy.coords it says:
If 'y' is missing and 'x' is a
formula: of the form 'yvar ~ xvar'. 'xvar' and 'yvar' are used as
x and y variables.
list: containing components 'x' and 'y', these are used to define
plotting coordinates.
time series: the x values are taken to be 'time(x)' and the y
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
2019 Apr 05
2
Deep Replicable Bug With AMD Threadripper MultiCore
The following program is whittled down from a much larger program that
always works on Intel, and always works on AMD's threadripper with
lapply but not mclappy. With mclapply on AMD, all processes go into
"suspend" mode and the program then hangs. This bug is replicable on an
AMD Ryzen Threadripper 2950X 16-Core Processor (128GB RAM), running
latest ubuntu 18.04. The R version
2009 Apr 22
2
Exporting objects plotted with plot3d() - rgl package
Dear all,
Can anybody tell me how to export a 3d figure made with the plot3d
function? I'm careless about whether it's still interactive or not in
another format, as long I can get it out of R.
Thanks!
Alejandro Gonz?lez
Departamento de Biodiversidad y Conservaci?n
Real Jard?n Bot?nico
Consejo Superior de Investigaciones Cient?ficas
Claudio Moyano, 1
28014 Madrid, Spain
Tel +0034
2009 Jan 30
3
identifying what labels have been created in a plot
Colleagues
R 2.8.0; OS X, Vista, Ubuntu Linux
In some instances, when I create a graphic using plot(XVAR, YVAR), it
would be valuable to know the values that R will display on the y-axis
(e.g., if the range of data is 0-70, it might display 0, 10, 30, 50,
70). Is there a simple means to access these values?
Also, in some instances, additional ticks appear between the displayed
values
2010 Jan 13
1
Rollapply
Hi
I would like to understand how to extend the function (FUN) I am using in
rollapply below.
######################################
With the following simplified data, test1 yields parameters for a rolling
regression
data = data.frame(Xvar=c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36),
Yvar =c(78.01,77.07,77.35,76.72,77.49,78.70,77.78,79.58))
data.z = zoo(d)
test1 =
2009 Apr 21
6
Sampling in R
[This email is either empty or too large to be displayed at this time]
2018 Jan 26
1
plm empty model error
Hi,
I am trying to estimate a two-way model with both individual and time fixed
effects. I am using plm with "twoways" specification.
plm(as.integer(yvar) ~ xvar, index = c("id", "time"), model="within",
data=dataset, effect = "twoways")
But I get keep getting the following message and I don't know what to do
about it, because I don't