Displaying 20 results from an estimated 10000 matches similar to: "lm with ordered factors"
2006 Aug 22
1
summary(lm ... conrasts=...)
Hi Folks,
I've encountered something I hadn't been consciously
aware of previously, and I'm wondering what the
explanation might be.
In (on another list) using R to demonstrate the difference
between different contrasts in 'lm' I set up an example
where Y is sampled from three different normal distributions
according to the levels ("A","B","C")
2004 Apr 18
2
lm with data=(means,sds,ns)
Hi Folks,
I am dealing with data which have been presented as
at each x_i, mean m_i of the y-values at x_i,
sd s_i of the y-values at x_i
number n_i of the y-values at x_i
and I want to linearly regress y on x.
There does not seem to be an option to 'lm' which can
deal with such data directly, though the regression
problem could be algebraically
2004 Jun 15
4
"Glueing" factors together
Hi folks,
Suppose I have a series of cases each with categorical
factors A, B.
What is the best way to "glue" A and B together into a single
factor? For example, given
A0 B1 ...
A1 B1 ...
A0 B2 ...
A1 B0 ...
A0 B0 ...
A1 B2 ...
then I'd like to end up with a single factor with levels
A0B0, A0B1, A0B2, A1B0, A1B1, A1B2
according to all the combinations which actually occur in
2002 Dec 17
4
Quick tip please!
I have two CSV files (exported from Excel), say file1 and file2.
The have the same number of rows, and each has several columns,
with names on the first line; and some of the columns in file1
are repeated in file2.
Using the "foreign" package, I can read these in separately
to dataframes say d1 and d2 with
> d1<-read.csv("file1")
>
2002 Dec 10
3
clogit and general conditional logistic regression
Can someone clarify what I cannot make out from the
documentation?
The function 'clogit' in the 'survival' package is
described as performing a "conditional logistic regression".
Its return value is stated to be "an object of class clogit
which is a wrapper for a coxph object."
This suggests that its usefulness is confined to the sort of
data which arise in
2002 Dec 20
1
Printing correlation matrices (lm/glm)
Hi Folks,
I'm analysing some data which, in its simplest aspect,
has 3 factors A, B, C each at 2 levels.
If I do
lm1 <- lm(y ~ A*B)
say, and then
summary(lm1, corr=T)
I get the correlation matrix of the estimated coeffcients
with numerical values for the correlations (3 coeffs in this
case). Likewise with 'glm' instead of 'lm'.
However, if I do
lm2 <- lm(y ~
2003 Jun 25
2
Execution of R code
Greetings Folks,
When R code (as entered or read from a courced file) is executed,
is it interpreted from the input form every time having once been
read in, or do subsequent invocations use an "intermediate"
(pre-interpreted) form?
Or, putting it another way, is the execution of R code faster
second time time round (and later) because the pre-interpretation
has already been done once
2003 Sep 04
3
Putting regression lines on SPLOM
Sorry Folks,
I'm sure I could suss out the answer myself but I need it
soon ... !
1. Given a set of 4 variables X,Y,Z,W in a dataframe DF, I make
a scatter-plot matrix using splom(DF).
2. I do all regressions of U on V using lm(U~V), where U and V
are all 12 different ordered pairs from X,Y,Z,W.
3. Now I would like to superpose the regression lines from (2)
onto the corresponding
2003 Oct 09
4
Automatic re-looping after error
Hi Folks,
I'm seeking advice about how to resume an outer loop following
failure of a function within the loop (which issues an error
message).
Essentially, I'm repeating (simulating) a process which involves
random sampling, EM and MCMC. I'm walking on very edge of rather
thin ice -- data rather thinly spread over many parameters!
Occasionally some component of the loop fails, with
2003 Dec 04
4
Selecting subsamples
Hi all,
I?m working with a dataset with 9 columns and 2000 rows. Each row represents
an individual and one of the columns represents the volume of that individual
(measured in cubic meters). I?d like to select a sample from this dataset
(without considering any probability of the rows) in which the sum of the
volume of the individuals in that sample >= 100 cubic m.
I?ll appreciate any
2004 May 04
2
Superposing data on boxplot
Hi folks,
I have a vaiable Y and an associated factor Z at several (13)
levels.
boxplot(Y~Z)
produces a nice array of boxplots, one for each level of Z,
and each duly labaelled with its level of Z.
I would like to superpose on each boxplot the actual data
points which it represents, i.e. do something conceptually
(though not in real R) expressed as
points(Y~Z)
or
points(Z,Y)
It can
2003 Sep 20
3
conditional function definition?
Hi Folks,
What is the best way to avoid a function being read in
anew (and masking an exiting function) when a definition
of it has already been established in R?
Reason: Fernando Tusell and I are working up Schafer's 'CAT'
for R (basically done now, just needs some cosmetic tidying up).
This uses a function 'slice.index', present in S but not in
the versions of R we were
2002 Oct 17
3
Non-central distributions
Hi Folks,
I note that, while the "chisq" functions
dchisq(x, df, ncp=0, log = FALSE)
pchisq(q, df, ncp=0, lower.tail = TRUE, log.p = FALSE)
qchisq(p, df, ncp=0, lower.tail = TRUE, log.p = FALSE)
rchisq(n, df, ncp=0)
all have a slot for the non-centrality parameter "ncp", of
the functions for the t and F distributions:
dt(x, df, log = FALSE)
2003 Jun 20
4
Spedd: R vs S-plus
Hi Folks,
Sorry to raise what has probably been discussed before,
but I an repeatedly struck by the comparative slowness
of S-plus for Windows compared with R for Linux when doing
much the same thing.
I don't have a direct comparison, because they're not
running on the same machine; but machine W has a faster
CPU and more RAM than machine L, yet S-plus on W seems
to take longer by quite
2004 Jan 12
3
? data.entry "read-only" ?
Hi Folks,
The spreadsheet-like layout displayed when 'data.entry' is
invoked is very useful simply for legible display of data,
quite apart from its intended use for the purpose of entering
or editing data.
If one wants to use it _simply_ as a display device, so that
one can look around inside a data-set while working on it,
then it is not a good idea to have its _editing_ capabilities
2002 Apr 08
4
Missing data and Imputation
Hi Folks,
I'm currently looking at missing data/imputation
methods (including multiple imputation).
S-Plus has a "missing data library".
What similar resources are available within R?
Or does one roll one's own?
Best wishes to all,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
2003 Oct 20
2
"aliases" for R constructs?
Hi Folks,
My recent response to Laura Quinn's query about matrix subsetting
reminded of a question.
I wrote:
iDir <- ((Winds[,20]<45)|(Winds[,20]>315))&(!is.na(Winds[,20]))
Now, I find "!is.na" a bit awkward to type, so I might prefer to
type it as "nis.na".
While it is possible to define
nis.na <- function(x){ !is.na(x) }
this involves a slight
2011 Dec 02
2
Unexplained behavior of level names when using ordered factors in lm?
Hello dear all,
I am unable to understand why when I run the following three lines:
set.seed(4254)
> a <- data.frame(y = rnorm(40), x=ordered(sample(1:5, 40, T)))
> summary(lm(y ~ x, a))
The output I get includes factor levels which are not relevant to what I am
actually using:
Call:
> lm(formula = y ~ x, data = a)
> Residuals:
> Min 1Q Median 3Q Max
>
2003 May 24
3
help output paged in separate window
Hi folks,
I use R in X windows on Linux.
Normally, I use 'less' as pager, which is fine for scanning through
'help' (or '?') output in the R window itself; the help session is
terminated by typing "q", as usual for 'less', and the R window then
reverts to the R command line interface.
Often, I would like to have the output from 'help' pop up in
2003 May 24
3
help output paged in separate window
Hi folks,
I use R in X windows on Linux.
Normally, I use 'less' as pager, which is fine for scanning through
'help' (or '?') output in the R window itself; the help session is
terminated by typing "q", as usual for 'less', and the R window then
reverts to the R command line interface.
Often, I would like to have the output from 'help' pop up in