Displaying 20 results from an estimated 10000 matches similar to: "Starting values for glm fits"
2003 Sep 08
2
How do I coerce numeric factor columns of data frame to vector?
I have just noticed that quite a few columns of a data frame that I am
working on are numeric factors. For summary() purposes I want them to be
vectors. I tried, for example
> indx <- c(1:18,21:37,40,41)
> i <- 0
> i <- i+1
> summary(as.vector(sflows1[indx[i]]))
Length Class Mode
min.pkt.sz 3000 factor numeric
but this does not give the five-number
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
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
2003 Sep 23
2
R-project [.com?] [.net?]
I got a shock a few days ago when I accidentally visited
www.r-project.com . I thought that the r-project site had been hacked
until I realised my mistake. There is also a site www.r-project.net.
Both of these sites appear to be Japanese. Does anyone know anything
about them? I suppose that it is not unusual for names close to those of
popular sites to be used. It is good that they use a
2003 Dec 30
4
Assignments in loops
Greetings all. Any help with the following would be appreciated.
I want to create a data frame for each file in a directory. The following
code does not work but it may show what I am trying to do:
carmakes <- c('BMW','Chrysler','Citroen','Fiat','Ford','Holden','Honda',
2003 Jan 12
1
likelihood and score interval estimates for glms
G'day list!
I'm thinking about programming likelihood and score intervals for
generalized linear models in R based on the paper "On the computation of
likelihood ratio and score test based confidence intervals in
generalized linear models" by Juha Alho (1992) (Statistics in Medicine,
11, 923-930).
Being lazy, I thought that I would ask if anyone else on the list has
2004 Apr 21
2
Rgui front-end has encountered a problem and needs to close
Well I don't know if anyone can help with this but it will be
interesting to know if others have had the same problem.
I can't start R at home on my laptop [ I'm using 1.8.1 under Windows
XP]. When I click on the shortcut I get the usual Windows box for when
an application needs to close. A couple of clicks down it displays the
following:
Error signature
AppName: rgui.exe
2002 Dec 03
2
Array multiplication
I wanted a sort of matrix product of an array and a matrix.
As there does not seem to be any array multiplication apart from outer()
I proceeded as follows:
lambda <- array(0, c(n,m,d))
# stuff omitted
# zed is an n by m matrix
#
# \lamb.star_{ik}
lamb.star <- matrix(0, nrow=n, ncol=d)
for (i in 1:n) {
for (k in 1:d) {
for (j in 1:m) {
lamb.star[i,k] = lamb.star[i,k] +
2003 Dec 08
2
Character graphics
Does anyone else miss email-friendly character graphics such as the
following example, produced using Minitab?
Histogram of C6 N = 478 N* = 21
Each * represents 2 observation(s)
Midpoint Count
-12 16 ********
-11 53 ***************************
-10 63 ********************************
-9 83
2003 Nov 12
1
Plotting lm() attributes
Suppose you fit a linear model
> model.1 ~ lm(v1 ~ ..., data=myframe)
and v2 is some other column of myframe typically not in the model. You
will often want to try
> plot(v2, model.1$residuals)
but this will fail if there are NAs in the response v1 as
model.1$residuals has length equal to the number of nonmissing values in
v1. I suppose
> plot(v2[!is.na(v1)],
2004 Feb 05
2
Sweave problem
Here is the file minimal.Snw:
\documentclass[a4paper]{article}
\title{R tips and tricks}
\author{Murray Jorgensen}
\usepackage{Sweave}
\begin{document}
\maketitle
\section*{Entering data from a single variable}
The following data are transformed tensile strength measurements on
polyester
fibres. They may be found on the file \texttt{TENSILE.DAT}. We
may enter this data into R using the
2002 Nov 07
1
Macros versus functions
R is a function-oriented language and functions have the advantage that
they control unintended side effects of computations on the workspace.
Still, there are times when I am using R when I want to make a large
number of changes to the worksheet repeatedly and where the easiest way
seems to be to keep pasting in the same chunk of code, or to put it on
a file and use
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
2004 Mar 01
3
Scanning tab-separated numbers
I want to paste in the following numbers into a scan:
0.023 0.032 0.054 0.069 0.081 0.094
0.105 0.127 0.148 0.169 0.188 0.216
they are separated by tabs alone, unless my mailer has done something to
the tabs.
Now have a look at this:
> scan()
1: 0.0230.0320.0540.0690.0810.094
1: 0.1050.1270.1480.1690.1880.216
Error in scan() : "scan" expected a real, got
2002 Oct 28
2
Combining simulation results
In one saved workspace I have the results of a simulation experiment stored
as an array "resarray".
> dim(resarray)
[1] 10 6 500 3
In another workspace I have a similar array from another run of the
simulation.
I want to combine the two arrays into a single array of dimensions
10, 6, 1000, 3
What's the best way to do this?
Murray Jorgensen
Dr Murray Jorgensen
2003 Dec 14
5
reverse lexicographic order
Hi all,
I have some email addresses that I would like to sort in reverse
lexicographic order so that addresses from the same domain will be
grouped together. How might that be done?
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
2003 Mar 17
1
help with likelihood contour plot
Can some kind person point out my error here? I'm trying to set up a
grid for a countour plot of a likelihood function.
> u <- rnorm(20,9.5,2.5)
> # sample of size 20 from N(9.5,2.5^2)
> loglik <- function(th1,th2) {
+ n <- length(u)
+ -(n/2)*log(2*pi*th2^2)-0.5*sum((u-th1)^2/th2^2)
+ }
> x <- seq(4.5,14.5,len=50)
> y <- seq(0.5,6,len=50)
> f <-
2004 May 14
1
Problem with logtrans, from library MASS
Greetings all!
This problem occurs using R 1.8.1 on Windows XP. I downloaded the
binaries for R and all packages, including the VR bundle, in December 2003.
The data consists of NZ$ prices and attributes for 643 cars.
> summary(price)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
14290 35800 48990 65400 79000 285000 2
> library(MASS)
> boxcox(price
2002 Sep 30
2
Decompose numerical factor into orthog. poly parts
Consider the following analysis of a class experiment done as a Latin Square:
> spinner <- gl(4,4,16,label=c("Murray","Angela","Shasha","Stephen"))
> order <- gl(4,1,16)
> treat <- scan()
1: 1 2 4 3
5: 4 3 1 2
9: 3 4 2 1
13: 2 1 3 4
17:
Read 16 items
> coin <-
2004 Jul 12
1
Nested source()s
I had an error message while running a macro from Yudi Pawitan's web site:
> source("ex2-13.r")
Error in parse(file, n, text, prompt) : syntax error on line 2
Inspecting ex2-13.r I found that the error was generated by another
source() command.
Clearly R does not like nested source()s, which is fair enough when you
think about it. Still it's something that you might want