search for: lm2

Displaying 20 results from an estimated 62 matches for "lm2".

Did you mean: l2
2003 Jul 30
2
Comparing two regression slopes
...ned, 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 I've missed something in my function? I'd be very grateful for any tips. Thanks! Martin TwoSlope <-function(lm1, lm2) { ## lm1 and lm2 are two linear models on independent data sets coef1 <-summary(lm1)$coef coef2 <-summary(lm2)$coef sigma <-(sum(lm1$residuals^2)+sum(lm2$residuals^2))/(lm1$df.residual + lm2$df.residual-4) SSall <-sum(lm1$model[,2]^2) + sum(lm2$model[,2]^2) SSprod <-sum(lm1$mode...
2012 Mar 25
1
Accessing more than two coefficients in a plot
I've successfully plotted (in the plot and abline code below) a simple regression of Lambda1_2 on VV1_2. I then successfully regressed Lambda1_2 on VV1_2, VV1_22 and VV1_212 producing lm2.l. When I go to plot lm2.l using abline I get the warning: "1: In abline(lm2.l, col = "brown", lty = "dotted", lwd = 2) : only using the first two of 4 regression coefficients" Is there another function like abline that will produce a line using the constant and thre...
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)
...e(y~x,data=demo,random=~1|subj) > print(summary(demo.lm1)) > newframe<-data.frame(x=1:5,subj=rep(1,5)) > predict(demo.lm1,newframe,level=0) > > fma<-as.formula("y~x") > demo.lm<-lm(fma,data=demo) # ok > predict(demo.lm,newframe,level=0) # ok > demo.lm2<-lme(fma,data=demo,random=~1|subj) # looks ok, but isn't > print(summary(demo.lm2)) > > #Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector > #predict(demo.lm2,newframe,level=0) # does not work Thanks for the detailed report. I can reproduce the p...
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...
2012 Jul 06
2
Anova Type II and Contrasts
...is statistically significant: Observation.L 0.029141 0.012377 2.355 0.024 * Observation.Q 0.002233 0.012482 0.179 0.859 However, this first model does not include any of the two covariates. Including them results in a non-significant p-value for the linear relationship: lm2 <- lm(log(Variable) ~ Observation + COV1 + COV2, data = df1) summary.lm(lm2) Observation.L 0.04116 0.02624 1.568 0.126 Observation.Q 0.01003 0.01894 0.530 0.600 COV1A2 -0.01203 0.04202 -0.286 0.776 COV2B2 -0.02071 0.02202 -0.941 0.3...
2010 Apr 08
2
Overfitting/Calibration plots (Statistics question)
...> x2 <- rnorm(200, 0, 1) > x3 <- rnorm(200, 0, 1) > x4 <- rnorm(200, 0, 1) > x5 <- rnorm(200, 0, 1) > x6 <- rnorm(200, 0, 1) > y <- x1 + x2 + rnorm(200, 0, 2) > d <- data.frame(y, x1, x2, x3, x4, x5, x6) > > lm1 <- lm(y ~ ., data = d[1:100,]) > lm2 <- lm(y ~ x1 + x2, data = d[1:100,]) > > plot(predict(lm1, d[101:200, ]), d$y[101:200]); abline(0,1) > x11(); plot(predict(lm2, d[101:200, ]), d$y[101:200]); abline(0,1) The plots for both lm1 and lm2 show the points scattered around a line with slope > 1, contrary to what Frank Har...
2001 Feb 23
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
...=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)) predict(demo.lm1,newframe,level=0) fma<-as.formula("y~x") demo.lm<-lm(fma,data=demo) # ok predict(demo.lm,newframe,level=0) # ok demo.lm2<-lme(fma,data=demo,random=~1|subj) # looks ok, but isn't print(summary(demo.lm2)) #Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector #predict(demo.lm2,newframe,level=0) # does not work --------------------------------------- Dr. Dieter Menne Biomed Software...
2006 Mar 10
1
add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
...ne for y1 and y2 here: xyplot(y1+y2 ~ x | grp, data = foo) # like this example for just one y variable: xyplot(y1~x|grp, data = foo, panel = function(x,y) { lm1 = lm(y~x) panel.points(x,y, col = "red") panel.abline(lm1, col = "red") #lm2 = lm(y~x) # model for y2 #panel.points(x,y, col = "blue") #points for y2 #panel.abline(lm2, col = "blue") #abline for y2 }) > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major...
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 still load the...
2002 Dec 20
1
Printing correlation matrices (lm/glm)
...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 ~ A*B*C) and then summary(lm2, corr=T) I get only symbols (such as ".", "+", "*") for the values, denoting ranges, and not numbers (7 coefficients in this case). Presumably this happens when the number of columns is considered to be getting a bit large...
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
...nificance 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) Thanks in advance.
2012 Jan 13
2
Help needed in interpreting linear models
...0.00813 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.661 on 4 degrees of freedom Multiple R-squared: 0.8564, Adjusted R-squared: 0.8205 F-statistic: 23.86 on 1 and 4 DF, p-value: 0.008134 > > (lm2 <- summary(lm(scores ~ height))) Call: lm(formula = scores ~ height) Residuals: 1 2 3 4 5 6 -8.800e+00 -4.800e+00 1.377e-14 1.200e+00 3.200e+00 9.200e+00 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept)...
2008 Nov 24
3
Is this correct?
...s, 0 if they did not), and GPA (the grade point average at university). Discuss the relationship between taking part in sports, GPA, and income for these data. The R code I used so far is Does sports predict GPA? > lm1<-lm(GPA~sports) > summary(lm1) Does sports predict income? > lm2<-lm(income~sports) > summary(lm2) Does GPA predict income? > lm3<-lm(income~GPA) > summary(lm3) Does sports predict income after accounting for GPA? > lm4<-lm(income~GPA+sports) > summary(lm4) Can someone let me know is the above is correct? I am not sure if to keep al...
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 calculate a confidence interval for the mean VitC for each combination of Date and Cult, fixing the value of HeadWt...
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) Error in "row.names<-.data.frame"(*tmp*, value = as.character(match.call()[-1])) : invalid row.names length The offending line is row.nam...
2009 Nov 20
4
running dhcp-server on dom0 over a vnic.
...cuss I wanted to ask if anyone had tried this on this: I''m trying to run a dhcp-server on a dom0 over a vnic so that the domU''s can get IP addresses. I created a vnic r1 over e1000g0 and gave it a static IP 172.0.94.111/24 so I can run the dhcp server over this vnic. root@lm2-dom0:~# dhtadm -P Name Type Value ================================================== 172.0.94.0 Macro :Subnet = 255.255.255.0 :Router = 172.0.94.111 :Broadcst =172.0.94.255:NISdmain="celab.sfbay.sun.com":NISservs=129.146.17....
2014 Jun 13
3
p values con LMER
...es crear un modelo reducido sin la variable de la que quiero saber el pvalor y compararlos mediante un test anova. El valor obtenido por esta comparación puede utilizarse con el pvalor de esa variable. Por ejemplo: Lm1=lmer(rt_ln ~ (fre_ln * Z_nsize * frebase_ln + (1|word), data = x) Lm2= lmer(rt_ln ~ (Z_nsize * frebase_ln + (1|word), data = x) anova(Lm1,Lm2, test="Chisq") #Obtiens el pvalor de la variable ?fre_ln?   Lm3=lmer(rt_ln ~ (fre_ln * frebase_ln + (1|word), data = x) anova(Lm1,Lm3, test="Chisq") #Obtiens el pvalor de la variable ? Z_nsize...
2003 Oct 28
1
error message in simulation
...-c(1:nitns) param14<-c(1:nitns) for(itn in 1:nitns){ g<-rbinom(nsims,1,0.5) b<-rnorm(nsims,0,1)*10 rn<-rnorm(nsims,0,1)*10 a<-b*r+rn*(1-r^2)^0.5 a<-round(a)+50 a<-a-g*5 b<-round(b)+50 abs.2<-function(x) ifelse(x<1,1,x) b<-abs.2(b) c<-b-a p<-c/b lm1<-lm(a~g) lm2<-lm(c~g) lm3<-lm(p~g) lm4<-lm(a~b+g) gr<-c(g,g) occasion<-rep(0:1,c(nsims,nsims)) occ<-occasion-0.5 ppd<-c(b,a) h<-rep(0,nsims) mb<-mean(b) bppd<-b-mb bappd<-c(h,bppd) occgr<-occ*gr subject<-c(1:nsims) sub<-c(subject,subject) library(nlme) lm5<-lme(ppd~o...