Displaying 20 results from an estimated 100 matches similar to: "Accessing more than two coefficients in a plot"
2003 Jul 30
2
Comparing two regression slopes
Hello,
I've written a simple (although probably overly roundabout) function to
test whether two regression slope coefficients from two linear models on
independent data sets are significantly different. I'm a bit concerned,
because when I test it on simulated data with different sample sizes and
variances, the function seems to be extremely sensitive both of these. I am
wondering if
2004 Aug 19
3
List dimention labels to plots of components
It is frustrating to see the labels I want in the dimensions of a list but not be able to extract those labels into titles for plots generated from component objects. If someone could set me straight, I would appreciate it. For your amusement, I have provided an example of the Byzantine code I am currently using to avoid loops:
# Simulate ANOVA type test data
sex<-c(rep(1,8),rep(0,8))
2005 Aug 12
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
This is a continuing issue with the one on the list a long time ago (I
couldn't find a solution to it from the web):
--------------------------------------------------------------------------
> Using a formula converted with as.formula with lme leads
> to an error message. Same works ok with lm, and with
> lme and a fixed formula.
>
> # demonstrates problems with lme and
2006 Sep 03
2
lm, weights and ...
> lm2 <- function(...) lm(...)
> lm2(mpg ~ wt, data=mtcars)
Call:
lm(formula = ..1, data = ..2)
Coefficients:
(Intercept) wt
37.285 -5.344
> lm2(mpg ~ wt, weights=cyl, data=mtcars)
Error in eval(expr, envir, enclos) : ..2 used in an incorrect context,
no ... to look in
Can anyone explain why this is happening? (Obviously this is a
manufactured example, but it
2012 Jul 06
2
Anova Type II and Contrasts
the study design of the data I have to analyse is simple. There is 1 control group (CTRL) and 2 different treatment groups (TREAT_1 and TREAT_2).
The data also includes 2 covariates COV1 and COV2. I have been asked to check if there is a linear or quadratic treatment effect in the data.
I created a dummy data set to explain my situation:
df1 <- data.frame(
Observation =
2011 May 10
2
Leyenda de las series en tsplot
Hola de nuevo:
Sigo enfrascado con mi dichoso procedimiento para generar modelos de
predicción de series temporales.
Llegado un momento pretendo guardar un gráfico en el que se representara:
-En a estarán los puntos obtenidos por el alisado (tanto en el pasado como
las estimaciones a futuro)
-En o estará la serie de datos original.
-En inf los limites inferiores de los intervalos de confianza
2010 Apr 08
2
Overfitting/Calibration plots (Statistics question)
This isn't a question about R, but I'm hoping someone will be willing
to help. I've been looking at calibration plots in multiple regression
(plotting observed response Y on the vertical axis versus predicted
response [Y hat] on the horizontal axis).
According to Frank Harrell's "Regression Modeling Strategies" book
(pp. 61-63), when making such a plot on new data
2009 Jan 14
1
Help with Plot/Legend
Dear R-Users
I have 2 questions:
Firstly, If I create a matplot and legend for multiple vectors and then tag
another vector on using matlines (e.g. a 'total' of all vectors), is there
anyway to add the new line to the legend without recreating it? I have
created the plot this way because I would like to define the lty and lwd for
the 'total' vector so that it can be
2001 Feb 23
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
Using a formula converted with as.formula with lme leads
to an error message. Same works ok with lm, and with
lme and a fixed formula.
# demonstrates problems with lme and as.formula
demo<-data.frame(x=1:20,y=(1:20)+rnorm(20),subj=as.factor(rep(1:2,10)))
demo.lm1<-lme(y~x,data=demo,random=~1|subj)
print(summary(demo.lm1))
newframe<-data.frame(x=1:5,subj=rep(1,5))
2006 Mar 10
1
add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
Although this should be trivial, I'm having a spot of trouble.
I want to make a lattice plot of the format y1+y2 ~ x | grp but then fit a
lm to each y variable and add an abline of those models in different colors.
If the xyplot followed y~x|grp I would write a panel function as below, but
I'm unsure of how to do that with y1 and y2 without reshaping the data
before hand. Thoughts
2011 Aug 22
3
Ignoring loadNamespace errors when loading a file
On a Unix machine I ran caret::rfe using the multicore package, and I
saved the resulting object using save(lm2, file = "lm2.RData").
[Reproducible example below.]
When I try to load("lm2.RData") on my Windows laptop, I get
Error in loadNamespace(name) : there is no package called 'multicore'
I completely understand the error and I would like to ignore it and
2002 Dec 20
1
Printing correlation matrices (lm/glm)
Hi Folks,
I'm analysing some data which, in its simplest aspect,
has 3 factors A, B, C each at 2 levels.
If I do
lm1 <- lm(y ~ A*B)
say, and then
summary(lm1, corr=T)
I get the correlation matrix of the estimated coeffcients
with numerical values for the correlations (3 coeffs in this
case). Likewise with 'glm' instead of 'lm'.
However, if I do
lm2 <- lm(y ~
2007 Dec 07
1
AIC v. extractAIC
Hello,
I am using a simple linear model and I would like to get an AIC value. I
came across both AIC() and extractAIC() and I am not sure which is best to
use. I assumed that I should use AIC for a glm and extractAIC() for lm,
but if I run my model in glm the AIC value is the same if I use AIC() on an
lm object. What might be going on? Did I interpret these functions
incorrectly?
Thanks,
2007 Aug 06
1
test the significances of two regression lines
R-help,
I'm trying to test the significance of two regression lines
, i.e. the significance of the slopes from two samples
originated from the same population.
Is it correct if I fit a liner model for each sample and
then test the slope signicance with 'anova'. Something like this:
lm1 <- lm(Y~ a1 + b1*X) # sample 1
lm2 <- lm(Y~ a2 + b2*X) # sample 2
anova(lm1, lm2)
2012 Jan 13
2
Help needed in interpreting linear models
Dear members of the R-help list,
I have sent the email below to the R-SIG-ME list to ask for help in
interpreting some R output of fitted linear models.
Unfortunately, I haven't yet received any answers. As I am not sure if my
email was sent successfully to the mailing list I
am asking for help here:
Dear members of the R-SIG-ME list,
I am new to linear models and struggling with
2000 Feb 02
0
Bugs and comments. (PR#410)
Hi,
Here are a few errors I found as well as a few comments.
1) In the man page of par:
lty: The line type. Line types can either be specified
as an integer (0=blank, 1=solid, 2=dashed, 3=dot-
ted, 4=dotdash, 5=longdash, 6=twodash) or as one
of the character strings `"blank"', `"solid"',
2008 Nov 24
3
Is this correct?
I have to answer the following question for a homework assignment.
A researcher was interested in whether people taking part in sports at
university made more money after graduating, taking into account the
students' GPA. They sampled 200 alumni from a large university. The
variables are: income (income 10 years after graduating), sports (1 if they
did sports, 0 if they did not), and GPA (the
2018 Jul 18
2
Legendas en una gráfica de ggplot2
Buenas tardes, estoy haciendo una gráfica de múltiples lineas pero no he
podido generar las legendas. Alguno de ustedes me podría colaborar.
library(ggplot2)
#### Con b=-2
t=seq (-4, 4, by=0.01)
l=exp(t+2)/(1+(exp(t+2)))
##con b igual a -1
t=seq (-4, 4, by=0.01)
o=exp(t+1)/(1+(exp(t+1)))
### Con b igual a 0.7
t=seq (-4, 4, by=0.01)
i=exp(t-0.7)/(1+(exp(t-0.7)))
### Con b igual a 2
t=seq
2003 Feb 01
0
AIC.default (PR#2518)
There is a bug in AIC.default and AIC.lm, as illustrated below.
(I've only checked this under 1.6.1, and can't easily check if it has
already been reported since the site is down.)
> lm1 <- lm(y ~ x, list(x=1:10, y=jitter(1:10)))
> lm2 <- lm(y ~ x, list(x=1:10, y=jitter(1:10)))
> AIC(lm1, lm2)
df AIC
lm1 3 -18.662493
lm2 3 -7.265906
> AIC(lm1, lm2, k = 2)
2008 Oct 05
1
Help on R Coding
Hi all,
I am kind of stuck of using Predict function in R to make prediction
for a model with continuous variable and categorial variables. i have
no problem making the model, the model is e.g.
cabbage.lm2<- lm(VitC ~ HeadWt + Date + Cult)
HeadWt is a continuous variable, Date and Culte are factors. Date have
three levels inside (d16,d20,d21), Cult has two levels(c39,c52). I
need to