Displaying 20 results from an estimated 3000 matches similar to: "stopping stepAIC (MASS package)"
2009 Feb 06
1
Introduction to maps (of Denmark)?
Dear R-listers,
I am using R for Windows Vista 64-bit. I have no experience working with
maps, but now I have to plot a map of Denmark in which each Danish
county is color-coded according to its incidence rate of a particular
disease. My problem is that I don't know where to start. I have read the
help files to packages like 'mapplot', and their examples indicate that
I am on the
2009 Feb 02
1
Assigning colnames in loop
Dear R-listers,
I am trying to assign colnames to a data frame within a loop, but I keep
getting a "target of assignment expands to non-language object"-error. I
need to split up a large dataset into about 20 smaller ones, and I would
like to assign colnames within the loop, so I won't have to type the
same thing 20 times over.
I have concocted this really goofy example which
2009 Jan 26
1
Sweave'ing Danish characters
Hi,
I am writing an Sweave document and am using 'xtable' to make frequency tables of diagnoses of people undergoing cholecystectomy. Some of these diagnoses contain Danish characters ("?", "?", and "?"), and these characters are all garbled in the Latex document after I run Sweave. The odd thing is, everything looks absolutely right in the R console, and if
2005 Jun 23
0
Error in stepAIC function using a survival model
I keep getting the same error in my survival analysis. I have access to a
very large database but am just using small subsets to get some results. In
this particular subset there is 50 explanatory variables(both factors of
many levels and covariates) and 117 data pieces with some of the data being
censored. I am using the stepAIC command to find my model. My initial
model is built from all
2008 Nov 06
2
Data manipulation question
Dear R-listers,
I am a relatively inexperienced R-user currently migrating from Stata. I
am deeply frustrated by this data manipulation question: I know how I
could do it in Stata, but I cannot make it work in R.
I have a data frame of hospitalization data where each row represents an
admission. I need to know when patients were first discharged, but the
problem is that patients were sometimes
2005 Feb 25
0
Problem using stepAIC/addterm (MASS package)
Hello,
I'm currently dealing with a rather strange problem when using the
function "stepAIC" ("MASS" package). The setting is the following: From
model learning data sets ("learndata"), I want to be able to build
prediction functions (in order to save them in a file for further use).
This is done by the function "pred.function" (see below). Therein,
2008 Jun 21
1
stepAIC {MASS}
In a generalized linear model with k covariates, there are 2(kth power) - 1
possible models (excluding interactions).
Awhile ago a posting to R-help suggested Model Selection and Multimodel
Inference, 2nd ed, by Burnham and Anderson as a good source for
understanding model selection. They recommend (page 71) computing AIC
differences over all candidate models in the set of possible models.
After
2009 May 05
0
stepAICc function (based on MASS:::stepAIC.default)
Dear all,
I have tried to modify the code of MASS:::stepAIC.default(), dropterm() and addterm() to use AICc instead of AIC for model selection.
The code is appended below. Somehow the calculations are still not correct and I would be grateful if anyone could have a look at what might be wrong
with this code...
Here is a working example:
##
require(nlme)
model1=lme(distance ~ age + Sex, data =
2006 Sep 25
1
nlme with a factor in R 2.4.0beta
Hi,
the following R lines work fine in R 2.4.0 alpha (and older R versions), but not in R
2.4.0 beta (details below):
library(drc) # to load the dataset 'PestSci'
library(nlme)
## Starting values
sv <- c(0.328919, 1.956121, 0.097547, 1.642436, 0.208924)
## No error
m1 <- nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))),
fixed =
2007 Mar 20
1
Error in nlme with factors in R 2.4.1
Hi,
the following R lines work fine in R 2.4.0, but not in R 2.4.1 or any devel versions of R
2.5.0 (see below for details).
library(drc) # to load the dataset 'PestSci'
library(nlme)
## Setting starting values
sv <- c(0.43355869, 2.49963220, 0.05861799, 1.73290589, 0.38153146, 0.24316978)
## No error
m1 <-
nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))),
fixed =
2008 Oct 02
1
possible bug in function 'var' in R 2.7.2?
Dear R-Help,
I have used R2.6.0 until I recently installed also R2.7.2 (see details below)
In R 2.6.0, the following script using the function 'var' (cor(stats)):
x.test <- c(NA, NA, NA, NA)
var(x.test, na.rm=T)
gives the output:
NA
In R2.7.2 the output of the same script generates an error message and stops R:
'Error in var(x.test, na.rm = T)
2007 Sep 12
1
plot vs curve
Dear list members,
is it intentional that:
curve(cos, xlim = c(-5, 5))
plot(cos, xlim = c(-5, 5))
produce different plots?
Shouldn't the 'xlim' argument in both cases set the 'from' and 'to' argument if they
aren't supplied (at least that's what I understood reading the help page for 'curve' and
'plot.function')?
Christian
>
2012 May 10
1
fda problems - version correct?
Dear friends - I am trying to understand fda and working with the 2009
book from Springer. I run the scripts directly from a new installed fda
library and include sessionInfo() below. This is from the script
fdarm-ch09.R - I seem to have got not fda_2.2.8 but 2.2.7 - is that
the problem? Where do I get .8 as I just reinstalled? Best wishes
Troels Ring, Nephrology
Aalborg, Denmark
>
2011 Jan 24
1
Strange result from sort: sort(c("aa", "ff")) gives "ff" "aa" with R.2.12.1 on windows 7
Dear list,
Please consider the following call of sort
> sort(c("a","f"))
[1] "a" "f"
> sort(c("f","a"))
[1] "a" "f"
>
> sort(c("aa","ff"))
[1] "ff" "aa"
> sort(c("ff","aa"))
[1] "ff" "aa"
The last two results look strange
2011 Sep 15
1
Can't get installing a package source (.tar.gz) from a web page to work...
I have created an R-package with datasets which I want my students to install (the package is not on CRAN).
1) I've put the package on the web in a directory called 'data' and I thought I could do:
> install.packages("http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz",repos=NULL,type="source")
Warning: invalid package
2008 Sep 30
2
weird behavior of drop1() for polr models (MASS)
I would like to do a SS type III analysis on a proportional odds logistic
regression model. I use drop1(), but dropterm() shows the same behaviour. It
works as expected for regular main effects models, however when the model
includes an interaction effect it seems to have problems with matching the
parameters to the predictor terms. An example:
library("MASS");
options(contrasts =
2008 Dec 08
1
residual standard error in rlm (MASS package)
Hi,
I would appreciate of someone could explain how the residual standard
error is computed for rlm models (MASS package). Usually, one would
expect to get the residual standard error by
> sqrt(sum((y-fitted(fm))^2)/(n-2))
where y is the response, fm a linear model with an intercept and slope
for x and n the number of observations. This does not seem to work for
rlm models and I am wondering
2008 Feb 14
0
GCV in lm.ridge (MASS) (PR#10755)
Full_Name: Andrew Robinson
Version: 2.6.2 Patched (2008-02-12 r44439)
OS: FreeBSD 6.3-RC1
Submission from: (NULL) (211.28.206.186)
I believe that the computation for GCV is incorrect in the lm.ridge function in
MASS.
>From lm.ridge:
GCV <- colSums((Y - X %*% coef)^2)/
(n - colSums(matrix(d^2/div, dx)))^2
The denominator does not tally with the formula on p. 141 of Ripley's
2009 Jan 06
0
Singularity of lda function in MASS package
I have two specific questions regarding the output of lda function in MASS.
#Question1:
#=========
n: sample size, p: number of variables
Some articles in the literature say that LDA is singular
for p > n-1. However, my experimentation with lda (default arguments) for
two class problems shows collinearity for p > n-2.
Does anyone know why this is the case? Does lda (MASS) use a
different
2005 Aug 22
1
Example in pdf() help file (PR#8083)
The example in the help file for pdf() plots the characters outside
the plotting area in this for loop:
for(i in c(32:255)) {
x <- i
y <- i
points(x, y, pch=i)
}
The following loop seems to be working as intended
for(i in c(32:255)) {
x <- (i-31)%%16
y <- (i-31)%/%16
points(x, y, pch=i)
}
As an extra