search for: x2_1

Displaying 3 results from an estimated 3 matches for "x2_1".

Did you mean: x21
2007 Feb 27
1
interactions and GAM
...11)+10000 data1[data1$x1==2,"y"]=data1[data1$x1==2,"x2"]^4*(-3)+rnorm(11)+10000 data1[data1$x1==3,"y"]=10000*data1[data1$x1==3,"x2"]+rnorm(5)+10000 library(lattice) xyplot(data1$y~data1$x2,groups=data1$x1) #creation of dummy variables for interactions data1$x2_1=ifelse(data1$x1=="1",data1$x2,NA) data1$x2_2=ifelse(data1$x1=="2",data1$x2,NA) data1$x2_3=ifelse(data1$x1=="3",data1$x2,NA) #model fitting library(gam) model=gam(y~s(x2_1)+s(x2_2)+s(x2_3)+x1,data=data1,na=na.gam.replace) #prediction fit well data : summary(model) plo...
2009 Sep 03
1
Help with GLM please!
...bels for this variable which are not the ones I specified (I get labels I even don't know where they are coming from)? set.seed(12345) dv <- gl(n=2, k=1, length=20, label=c("Yes", "No")) x1 <- rnorm(n=20, mean=100, sd=10) x2 <- gl(n=3, k=1, length=20, label=c("x2_1", "x2_2", "x2_3")) mydata <- data.frame(dv,x1,x2) mydata$f.x1 <- cut(x1, breaks=c(80,90,100,120)) mydata$f.x1 <- ordered(mydata$f.x1, labels=c("L1", "L2", "L3") , levels(mydata$f.x1)) #Specify desired labels mydata$f.x1 attach(mydata)...
2005 Sep 15
1
Coefficients from LM
Hi everyone, Can anyone tell me if its possibility to extract the coefficients from the lm() command? For instance, imagine that we have the following data set (the number of observations for each company is actually larger than the one showed...): Company Y X1 X2 1 y_1 x1_1 x2_1 1 y_2 x1_2 x2_2 1 y_3 x1_3 x2_3 (...) 2 y_4 x1_4 x2_4 2 y_5 x1_5 x2_5 2 y_6 x1_6 x2_6 (...) n y_n x1_n x2_n n y_n1 x1_n1 x2_n1 n y_n2 x1_n2 x2_n2 (...) I need to run a regression of Y=b0+b1*X1+b2*X2 for EACH company in the dataset and then retrieve the coefficients for each regression obt...