Displaying 20 results from an estimated 2000 matches similar to: "glm with multiple vars"
2011 Jan 28
6
R-/Text-editor for Windows?
Tinn-R (http://www.sciviews.org/Tinn-R/) is one of the topmost
suggestions when googling an R-(text-)editor for Windows. However,
to me it appears dissappointing that Tinn-R does not handle utf-8
(mac-roman, or any other) encoded R-scripts or, in general, text
files. Besides Emacs and the R built-in editor, could you
recommend a good editor for Windows, even some commmercial for a
small
2011 Mar 04
3
S. function calculating x +- y
Hello, I am looking for an elegant one-liner for the following
operation:
x <- rnorm(10)
y <- runif(10)
c(mean(x)-mean(y), mean(x)+mean(y))
I thought about
apply(data.frame(x, y), 2, mean)
but I don't know how to apply the +- operation on the result of
apply. Thanks, *S*
--
Sascha Vieweg, saschaview at gmail.com
2012 Aug 15
2
sample() from (un-)sorted vectors
Hello,
Vector y is an alphabetically sorted version of vector x. Will both
samples, X and Y, be "absolutely" random or will they have systematic
differences? And: Should I sort or shuffle a vector before sampling?
Thank you, *S*
x <- as.factor(LETTERS[sequence(10:1)])
y <- sort(x)
X <- sample(x, 5)
Y <- sample(y, 5)
--
Sascha Vieweg, saschaview at gmail.com
2011 Feb 13
6
From numeric vector to string vector
Hi there, I have a numeric vector let say:
Vect <- c(12.234, 234.5675, 1.5)
Now I want a string vector like:
changedVec <- c("012.234", "234.568", "001.500")
Would be grateful if somebody help me how can I do that.
Thanks and regards,
[[alternative HTML version deleted]]
2011 Mar 08
2
plotCI() with ggplot2
Hello
Currently, I plot some coefficients with some intervals using
function "plotCI()" (package "gplots") using the following code:
(m1 <- matrix(0:5, nrow=2, byrow=T, dimnames=list(c("v1", "v2"),
c("lo", "m", "hi"))))
m2 <- m1 + 1
library(gplots)
plotCI(
x=1:length(m1[, 1]),
pch="",
2011 Nov 18
3
Apply functions along "layers" of a data matrix
Hello
How can I apply functions along "layers" of a data matrix?
Example:
daf <- data.frame(
'id' = rep(1:5, 3),
matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )),
rep = rep(1:3, each=5)
)
The data frame "daf" contains 3 repetitions/layers (rep) of 4 variables
of 5 persons (id). For some reason, I want to calculate
2011 Apr 08
1
multinom() residual deviance
Running a binary logit model on the data
df <- data.frame(y=sample(letters[1:3], 100, repl=T),
x=rnorm(100))
reveals some residual deviance:
summary(glm(y ~ ., data=df, family=binomial("logit")))
However, running a multinomial model on that data (multinom, nnet)
reveals a residual deviance:
summary(multinom(y ~ ., data=df))
On page 203, the MASS book says that "here the
2012 Feb 19
3
Non-parametric test for repeated measures and post-hoc single comparisons in R?
Some attribute x from 17 individuals was recorded repeatedly on 6 time
points using a Likert scale with 7 distractors. Which statistical
test(s) can I apply to check whether the changes along the 6 time points
were significant?
set.seed( 123 )
x <- matrix( sample( 1:7, 17*6, repl=T ),
nrow = 17, byrow = TRUE,
dimnames = list(1:17, paste( 'T', 1:6, sep='' ))
)
I found
2011 Jan 20
1
predict() for bootstrapped model coefficients
I run a multinomial regression on a data set with an outcome that
has three values. First, I build an initial model, b.mod. Then I
run a loop to bootstrap the coefficients. For the initial model,
using "predict()", I can print the wrong/false predictions table.
But how do I get this table (that is, the predictions) for the
bootstrapped model? Thanks for hints, *S*
df <-
2011 Nov 29
1
md.pattern ('mice') failure with more than 31 variables
Hello
How come that the function md.pattern() from package 'mice' delivers a
warning when run over data sets with more than 31 variables?
library( 'mice' )
x <- as.data.frame(
matrix(
sample( c(1:3, 1:3, 1:3, NA), 7000, repl=TRUE ),
ncol=35,
dimnames=list(NULL,
paste('V', 11:45, sep="")
)
)
)
md.pattern(x) # Warning message:
2011 Dec 01
1
transform data.frame holding answers --> data.frame holding logicals
Hello
Hello
I have a data frame, x, holding 5 persons answering the question which
cars they have used:
# the data frame
x <- as.data.frame(
matrix(
c('BMW', '', '',
'Mercedes', 'VW', '',
'Skoda', 'VW', 'BMW',
'', '', '',
'VW', 'Skoda',
2011 Jan 27
5
Help needed
Hello I am trying to solve these problems and I am not allowed to use loops or ifs.
1st Question
My first question is that I have generated 100 random numbers from the uniform distribution then
A)add only the negative integers.
B)add elements until the first appearance of a negative element.
I know how to choose the negative elements for A but how to find integers?
And I dont know what to do
2011 Feb 06
1
boot() versus loop, and statistics option
Hello R users
I am quite new to bootstrapping. Now, having some data x,
----
R: set.seed(1234)
R: x <- runif(300)
----
I want to bootstrap simple statistics, mean and quantiles (.025,
.975). Currently, I run a loop
----
R: res <- as.data.frame(matrix(ncol = 3, dimnames = list(NULL,
... c("M", "Lo", "Hi"))))
R: for (i in 1:100) {
... y <-
2011 Jan 27
4
Writing program for these
Hello I am trying to solve these problems and I am not allowed to use loops or ifs.
1st Question
My first question is that I have generated 100 random numbers from the uniform distribution then
A)add only the negative integers.
B)add elements until the first appearance of a negative element.
I know how to choose the negative elements for A but how to find integers?
And I dont know what to do
2011 Jun 22
2
First package submission to CRAN
I'm preparing to submit my first package to CRAN, thanks to the help of too
many people to mention.
I've built and checked the package on Windows ( making a zip) and my path
points to the 64 bit version of R.
Everything builds and checks and the final warnings have been fixed. My
package is pure R with no source from
other languages. My questions are as follows. I've read the
2011 Feb 16
2
create a data frame with the given column names
how do I create a data frame with the given column names
_NOT KNOWN IN ADVANCE_?
i.e., I have a vector of strings for names and I want to get an _EMPTY_
data frame with these column names.
is it at all possible?
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final)
http://openvotingconsortium.org http://pmw.org.il http://memri.org
http://mideasttruth.com
2011 Apr 20
2
Include C++ DLL, error in ...: C symbol name not in load table
Hello R experts
I am googling and reading around, however, I can't get it working
(perhaps because I do not understand much C, however, I'll give it
a try). I am trying to include C++ code into an R routine, where
the C++ code looks:
#include <iostream>
using namespace std;
void foo (double* x, double* y, double* out)
{
out[0] = x[0] + y[0];
}
Back in R, the command
R CMD
2011 Feb 12
4
From SPSS Syntax to R code
There is a code from SPSS Syntax
do if sub(ATVK,2,2)="01".
comp strata=1.
else if sub(ATVK,2,2)>="05" and sub(ATVK,2,2)<="27".
comp strata=3.
else if sub(ATVK,4,2)>"20" or sub(ATVK,6,2)>"20".
comp strata=4.
else if sub(ATVK,4,2)>"00".
comp strata=2.
end if.
value labels strata 1 "R 2 "Li" 3 "M" 4
2011 Apr 16
2
Rotating the x-axis labels of a barplot
Dear listserv,
Here is my latest formatting problem. I would like to rotate the x-axis labels
by 45 degrees on a _barplot_. Apparently this is slightly different from the
example given in the R FAQ, which is for rotating the x-axis labels on a
scatterplot
(http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f).
I have adapted that code, as best I could, and
2011 Jan 27
2
creating categorical frequency tables from continuous data
Hello,
I am working with a dataset which essentially has only one column - a
list of distances in metres, accurate to several decimal places. eg
distance
1000
6403.124
1000
1414.214
1414.214
1000
I want to organise this into a frequency table, grouping into categories
of 0 - 999, 1000 - 1999, 2000-2999 etc. I'd also like the rows where
there are no data points in that category to