similar to: step() and stepAIC()

Displaying 20 results from an estimated 3000 matches similar to: "step() and stepAIC()"

2006 Nov 13
1
stepAIC for overdispersed Poisson
I am wondering if stepAIC in the MASS library may be used for model selection in an overdispersed Poisson situation. What I thought of doing was to get an estimate of the overdispersion parameter phi from fitting a model with all or most of the available predictors (we have a large number of observations so this should not be problematical) and then use stepAIC with scale = phi. Should this
2010 Jul 27
4
Sweave and scan()
I am introducing the scan() function to my class. Consider the following file (Scanexamp.Rnw ) \documentclass[12pt]{article} \begin{document} <<>>= height = scan() 64 62 66 65 62 69 72 72 70 part = scan(what = character(0)) "Soprano" "Soprano" "Soprano" "Alto" "Alto" "Tenor" "Tenor" "Bass"
2006 Apr 14
5
vector-factor operation
I found myself wanting to average a vector [vec] within each level of a factor [Fac], returning a vector of the same length as vec. After a while I realised that lm1 <- lm(vec ~ Fac) fitted(lm1) did what I want. But there must be another way to do this, and it would be good to be able to apply other functions than mean() in this way. Cheers, Murray -- Dr Murray Jorgensen
2011 Jan 05
4
Converting Fortran or C++ etc to R
I'm going to try my hand at converting some Fortran programs to R. Does anyone know of any good articles giving hints at such tasks? I will post a selective summary of my gleanings. Cheers, Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz
2006 Nov 13
2
A printing "macro"
I am exploring the result of clustering a large multivariate data set into a number of groups, represented, say, by a factor G. I wrote a function to see how categorical variables vary between groups: > ddisp <- function(dvar) { + csqt <- chisq.test(G,dvar) + print(csqt$statistic) + print(csqt$observed) + print(round(csqt$expected)) + round(csqt$residuals) + } > > x
2008 Mar 02
2
Recommended Packages
Having just update to R 2.6.2 on my old Windows laptop I notice that the number of packages is growing exponentially and my usual approach of get-em-all may not be viable much longer. Has any thought been given to dividing "contributed" binaries into a recommended set, perhaps a couple of hundred, and the remained. That way one could install the recommended ones routinely and add in
2006 Jun 05
1
Extracting Variance components
I can ask my question using and example from Chapter 1 of Pinheiro & Bates. > # 1.4 An Analysis of Covariance Model > > OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] > fm1OrthF <- + lme( distance ~ age, data = OrthoFem, random = ~ 1 | Subject ) > summary( fm1OrthF ) Linear mixed-effects model fit by REML Data: OrthoFem AIC BIC
2010 Jun 14
2
Html help
I have just installed R 2.11.1 on my XP laptop. I like html help for browsing but text help for on-the-fly look-ups. I was a bit surprised when I was asked to choose between them during the installation. I chose text, thinking I could fix the html help later, which is what I am trying to do now. Now when I ask for html help my browser goes to 'http://-ip-number-/doc/html/index.html'
2006 Aug 20
3
unquoting
I would like a function to strip quotes off character strings. I should work like this: > A <- matrix(1:6, nrow = 2, ncol=3) > AF <- as.data.frame(A) > names(AF) <- c("First","Second","Third") > AF First Second Third 1 1 3 5 2 2 4 6 > names(AF)[2] [1] "Second" > attach(AF) >
2009 Nov 25
2
R or C++ on FreeNX servers
Hi all, I have just found out that the machine learning group in our Faculty has a lot of spare capacity on their FreeNX servers. I do not know a lot about these beasts but I understand that they are a free version of something produced by a firm called "NoMachine". They are designed for executing parallel algorithms and I thought that they might be of use in a project of mine
2006 Aug 01
4
Fitting models in a loop
If I want to display a few polynomial regression fits I can do something like for (i in 1:6) { mod <- lm(y ~ poly(x,i)) print(summary(mod)) } Suppose that I don't want to over-write the fitted model objects, though. How do I create a list of blank fitted model objects for later use in a loop? Murray Jorgensen -- Dr Murray Jorgensen
2007 Jan 05
4
ifelse on data frames
[Using R 2.2.0 on Windows XP; OK, OK, I will update soon!] I have noticed some undesirable behaviour when applying ifelse to a data frame. Here is my code: A <- scan() 1.000000 0.000000 0.000000 0 0.00000 0.027702 0.972045 0.000253 0 0.00000 A <- matrix(A,nrow=2,ncol=5,byrow=T) A == 0 ifelse(A==0,0,-A*log(A)) A <- as.data.frame(A) ifelse(A==0,0,-A*log(A)) and this is the output:
2007 Dec 05
2
Dimension of a vector
Consider the following: > A <- 1:10 > A [1] 1 2 3 4 5 6 7 8 9 10 > dim(A) NULL > dim(A) <- c(2,5) > A [,1] [,2] [,3] [,4] [,5] [1,] 1 3 5 7 9 [2,] 2 4 6 8 10 > dim(A) [1] 2 5 > dim(A) <- 10 > A [1] 1 2 3 4 5 6 7 8 9 10 > dim(A) [1] 10 Would it not make sense to have dim(A) = length(A) for all vectors?
2002 Nov 05
1
add1 in glm
I'm having a bit of difficulty using the stepwise model-building tools in a glm context. Here, for example is one problem I have had using add1, where the abbreviation "." does not work as I expected it to do. I someone could point me towards some examples involving the interactive building of glm models I would be grateful. The data set that I am using is the
2008 Aug 26
2
lattice plotting character woes
The following reproducable code shows the setting of my problem: set.seed(260808) n = 50 x = rnorm(n) y = rnorm(n) z = ceiling(runif(n,0,4)) g = runif(n,0,6) G = factor(ceiling(g)) xyplot(y ~ x | G) plsy <- trellis.par.get("plot.symbol") plsy$pch = z trellis.par.set("plot.symbol",plsy) xyplot(y ~ x | G) plsy$pch = as.character(z)
2009 Aug 02
3
two-factor linear models with missing cells
I am wondering how to interpret the parameter estimates that lm() reports in this sort of situation: y = round(rnorm(n=24,mean=5,sd=2),2) A = gl(3,2,24,labels=c("one","two","three")) B = gl(4,6,24,labels=c("i","ii","iii","iv")) # Make both observations for A=1, B=4 missing y[19] = NA y[20] = NA data.frame(y,A,B) nonadd = lm(y ~
2003 Sep 17
5
Quit asking me if I want to save the workspace!
How do you stop R from putting up a dialog box when you quit Rgui? (I use Windows and I never save workspaces that way) Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz Fax 7 838 4155 Phone +64 7 838 4773 wk +64 7 849 6486 home
1999 Jan 07
2
errores
Happy New Year to all, I am using RW0631 and WIN98. 1. The command DATA only works for the base library. 2. The following code on page 312 of Venables and Ripley 1997 sitka.lme <- lme(size~treat*ordered(Time),random=~1,cluster=~tree,data=Sitka, serial.structure="ar1.continuous",serial.covariate=~Time) produced the following error message Error in lme(size ~ treat *
2003 Aug 20
5
Interlacing two vectors
I want to interlace two vectors. This I can do: > x <- 1:4 > z <- x+0.5 > as.vector(t(cbind(x,z))) [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 but this seems rather inelegant. Any suggestions? Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz
2001 May 22
2
MASS data sets
I'm running R 1.2.2 under windows 98 on a Pentium 133 laptop. I can't seem to retrieve the package MASS data sets: > library(MASS) > data(wtloss) Warning message: Data set `wtloss' not found in: data(wtloss) > data(abbey) Warning message: Data set `abbey' not found in: data(abbey) And yet all the .rda files for the MASS datasets are in D:\Program