Displaying 20 results from an estimated 1000 matches similar to: "AIC"
2001 Sep 25
2
glm.nb, anova.negbin
Dear R-collegues,
I'm getting an error message (Error in round) when summarising a glm.nb
model, and when using anova.negbin (in R 1.3.1 for windows):
> m.nb <- glm.nb(tax ~ areal)
> m.bn
Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498,
link = log)
Coefficients:
(Intercept) areal
3.03146 0.03182
Degrees of Freedom: 283 Total (i.e. Null); 282
2000 Mar 16
2
glm: offset in poisson
R-users,
Can an offset term be included in a Poisson model?
I get an error message when trying that:
>r3o <- glm(tax ~ areal + offset(o), family=poisson)
Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, :
inner loop 1; can't correct step size
In addition: Warning message:
Step size truncated due to divergence in: (if (is.empty.model(mt))
2001 Dec 18
4
chi-squared test
I don't quite understand the difference between the two methods for
performing a chi-squared test on contingency tables: summary(table())
and chisq.test()
They may different results. E.g.:
aa <- gl(2, 10)
bb <- as.factor(c(1,2,2,2,1,2,1,2,2,2,1,2,2,2,1,1,1,2,1,1))
aa <- c(aa, aa)
bb <- c(bb, bb)
table(aa, bb)
summary(table(aa, bb))
chisq.test(aa, bb)
Could somebody give me
2003 Apr 24
1
matrix to coordinates
Dear R-users,
I'm sure it must be a specific function or a better way to convert
matrix to x,y,z coordinates (and viceversa), than my function below (it
works). Any help?
m2coord <- function(m)
{
k <- nrow(m)*ncol(m)
aa <- data.frame(r=1:k, c=1:k, v=1:k)
k <- 0
for (i in 1:nrow(m))
for (j in 1:ncol(m))
{
k <- k+1
aa$f[k]=i; aa$c[k]=j; aa$v[k]=m[i,j]
}
aa
}
Juli
2003 Dec 18
2
barplot & plot together
Dear colleges,
I'm trying to combine a barplot and a plot in a single figure as follows:
data <- 1:6
t <- barplot(data, axes=F)
par(new= T)
plot(t, data, type="b")
However, as you can see in the example, the dots of the second plot do
not fall in the midpoint of the bars in the first. Any trick for setting
the 2 plots at the same scale?
I have unsuccessfully tried:
plot(t,
2005 Oct 04
1
repeated measures with random effects
Dear all,
I'm interested in analysing a reapeated measure desing where plant
height (H) was measured 3 times (Time). The experimental design
include 2 fixed factor (say A and B) in which A is nested in B, and a
random factor (C, the plot), using the aov().
So my first idea would be something like:
aov(H ~ B * A %in% B * Time + Error(id) )
where id is the factor coded for the repeated
2002 May 11
2
RODBC sqlFetch
Hi,
Thanks for showing me how to use RODBC and odbcConnect.
Now works nicely. The question I've got now is:
noms <- list.files(pattern=".DBF")
# removing extension names:
noms <- sapply(noms, function(x) as.character(strsplit(x,".DBF")) ,
USE.NAMES=F)
for (i in 1:length(noms)) {
s <- sqlFetch(bdades, noms[i])
# etc.
}
But it seems that sqlFetch()
2008 Jun 26
1
write.table a df with specific column order
Hi
I'd like to write.table a dataframe, but with an specific order of
columns. Is there a direct way to do it? or I have to generate a new
dataframe as follows:
t <- data.frame(c=1:10, b=11:20, a=letters[1:10])
t2 <- data.frame(a=t$a, b=t$b, c=t$c)
write.table(t2, row.names=F)
Thanks for any comment
Juli
--
http://www.ceam.es/pausas
2008 Jun 27
1
removing blanks from a string
Hi
Is there a way to remove blank characters from the end of strings in a
vector? Something like the =TRIM functions of the OpenOffice
spreadsheet. E.g.,
a <- c("hola ", "Yes ", "hello ") # I'd like to get:
c("hola", "Yes", "hello")
Thanks
Juli
--
http://www.ceam.es/pausas
2008 Feb 10
2
reshape
Dear colleagues,
I'd like to reshape a datafame in a long format to a wide format, but
I do not quite get what I want. Here is an example of the data I've
have (dat):
sp <- c("a", "a", "a", "a", "b", "b", "b", "c", "d", "d", "d", "d")
tr <- c("A",
2008 Feb 27
1
glm binomial with no successes
Dear all,
I have a question on glm, family binomial. I do not see significant
differences between the levels of a factor (treatment) if all data for
a level is 0; and replacing a 0 for a 1 (in fact reducing the
difference), then I detect the significant difference that I expected.
Is there a way to overcome this problem? or this is an expected
behaviour ? Here is an example:
s <-
2007 Feb 02
5
reading very large files
Hi all,
I have a large file (1.8 GB) with 900,000 lines that I would like to read.
Each line is a string characters. Specifically I would like to randomly
select 3000 lines. For smaller files, what I'm doing is:
trs <- scan("myfile", what= character(), sep = "\n")
trs<- trs[sample(length(trs), 3000)]
And this works OK; however my computer seems not able to handle
2010 Jun 14
1
Install Rmpi
Hi everyone
As I couldn't succeed with manual installation of Rmpi I decided to
start again from the beginning. I removed R and MPICH in my Ubuntu Hardy
installation. Then, to avoid any dependencies problems I have installed
MPICH and R from synaptic, not from sources. But now I can't install Rmpi.
An error message appears when trying to install Rmpi, you can find in
2007 Sep 12
1
reshape help
Hi,
I'm trying to use reshape but I cannot quite understand how it works.
Could somebody help me on this? Example, my data is something like:
mydat <- data.frame(tree= 1:10, serra=rep(1:2, c(5,5)), bt01= 101:110,
bt02= 201:210, bt03= 301:310, mm01= 9101:9110, mm02= 9201:9210, mm03=
9301:9310)
> mydat
tree serra bt01 bt02 bt03 mm01 mm02 mm03
1 1 1 101 201 301 9101 9201
2011 Jun 03
1
R and DBSCAN
Hello everyone,
When looking for information about clustering of spatial data in R I was
directed towards DBSCAN. I've read some docs about it and theb new
questions have arisen.
DBSCAN requires some parameters, one of them is "distance". As my data
are three dimensional, longitude, latitude and temperature, which
"distance" should I use? which dimension is related to
2008 Jun 23
2
Handle missing values
Hi everyone
I am new to R and have a question about missing values. I am trying to
do a cluster analysis of monthly temperatures and my data are 14 columns
with spatial coordinates (lat,lon) and 12 monthly values:
/lat - lon - temp1 - //temp2 - temp3 - .... - //temp12/
If I omit missing values (my missing values are 99.00) with
/mydata <- na.omit(mydata)/
every row with a
2011 Mar 04
1
Time series analysis for a daily series
Hi everyone
I am trying to do some time series analysis with daily temperature data
(40 years). I have created a zoo object and ts object but can't apply
stl function. It says the series is not periodic or has less than two
periods. I've searched through google and found a lot of messages about
this problem but not a solution/example to look for trend and seasonal
component of a
2010 Jun 08
1
Problem installing Rmpi
Hi everyone
I want to install Rmpi to use R in parallel mode in a Linux cluster
(Ubuntu, Hardy Heron). It seems to be properly installed but a problem
appears when loading Rmpi library.
R version 2.11.1 (2010-05-31)
> library("Rmpi")
Error: package 'Rmpi' was built before R 2.10.0: please re-install it
Should I remove R-2.11 and install R-2.10? I have tried to
2007 Oct 14
0
repeated measures - aov, lme, lmer - help
Dear all,
I'm not very sure on the use of repeated measures in R, so some advice
would be very appreciate.
Here is a simple example similar to my real problem (R 2.6.0 for
windows): Lets supose I have annual tree production measured in 9
trees during 3 years; the 9 trees are located in 3 different mountains
(sites), and each tree receive different annual rainfall (different
locations). I would
2007 Oct 26
1
Use of all/any
all/any coerce their arguments to logical (if possible). I've added a
warning in R-devel if coercion is from something other than integer.
This arose because it is easy to make a slip and write all(X) > 0 rather
than all(X > 0): thanks to Bill Dunlap for bringing that to my attention.
However, it has been useful in detecting quite a few other things:
- indices which had been made