Displaying 5 results from an estimated 5 matches for "poly3".
Did you mean:
poly
2010 Jul 12
3
Continuing on with a loop when there's a failure
...t;NA"
or something similar in my results matrix for the bad y columns, but I want it
to keep going give me good data for the good y columns.
For instance:
results <- matrix(nrow = 1, ncol = 3)
colnames(results) <- c("y1", "y2", "y3")
for (i in 1:2) {
mod.poly3 <- lrm(x[,i] ~ pol(x1, 3) + pol(x2, 3), data=x)
results[1,i] <- anova(mod.poly3)[1,3]
}
If I run this code, it gives up when fitting y2 because the y2 is bad. It
doesn't even try to fit y3. Here's what my console shows:
> results
y1 y2 y3
[1,] 0.6976063 NA NA
As you...
2010 Jun 19
1
Extracting P-values from the lrm function in the rms library
...s 10 9
indv.5 bagels 0 2
indv.6 bagels 2 9
indv.7 bagels 8 5
indv.8 bagels 4 1
indv.9 donuts 3 3
indv.10 bagels 5 9
indv.11 bagels 9 10
indv.12 bagels 3 1
indv.13 donuts 7 10
indv.14 bagels 2 10
indv.15 bagels 9 6"), header = TRUE)
I am fitting a polynomial model to this dataset, namely:
mod.poly3 <- lrm(y ~ pol(x1, 3) + pol(x2, 3), data=x)
Here's my problem. If I look at the output, I can see a list of P-values (try typing "mod.poly3" and enter to see what I mean). But... how do I access this list of P-values? What I mean is, how can I "liberate" this list of P-v...
2010 Jun 18
1
Fitting a polynomial using lrm from the Design library
Hi all,
I am looking to fit a logistic regression using the lrm function from the Design library. I am interested in this function because I would like to obtain "pseudo-R2" values (see http://tolstoy.newcastle.edu.au/R/help/02b/1011.html).
Can anyone help me with the syntax?
If I fit the model using the stats library, the code looks like this:
model <- glm(x$trait ~ x$PC1 +
2010 Jul 20
1
Nesting functions in loops that result in error messages breaking the loop
Hello all,
I am trying to write a program in R in which I call a function multiple
times within a loop. The problem is that sometimes the function breaks down
while calling another function, and produces an error message that breaks my
loop and the program stops. I would like to keep the loop running when this
function breaks down, and just move on to the next iteration in the loop.
Is there
2003 Jun 17
2
Paste and namespace
Hi, my doubt is very simple. I'm sure I've seen someone using something
like this before, but unfortunatelly my searches in the archives were useless.
Well, I have some objects called after a name that has a number attached to
it,
varying. Let's say I have:
> ls
poly1 poly2 poly3 poly4 poly5 poly6 ...
I would like to access these objects using a for(), in which I could do
something like paste("poly",i,sep=''). For i = 4, for instance I get
> paste("poly",4,=sep'')
[1] "poly8"
Which is a string. What command should I use...