Displaying 20 results from an estimated 2000 matches similar to: "sample matrix"
2005 Apr 10
2
residuals in VGAM
Hi all:
I want to fit a multinomial logit model with VGAM package, however I cannot find a way to check the residuals since
residuals(my_model) and resid(my_model)
does not work.
Any suggestions?
Thanks in advance.
Alex Brito
[[alternative HTML version deleted]]
2005 Dec 14
2
Append tables
R Help:
I have read a number of tables into R with identical headings and I
would now like to make a single table that has all the data appended
under this single heading line.
for example:
t1 <- read.csv("f1",header=TRUE)
t2 <- read.csv("f2",header=TRUE)
all <- c(t1,t2)
#all is now twice as wide as t1 or t2 with the same number of row!!!!
#I need to know how
2005 Dec 13
2
creating a subset of a dataset using ifelse statement?
I am using R in a Microsoft Windows environment.
I have a dataset called “mp1b”. I have a variable called h.
h can take a value from -1 to 5.
If h <1, I want to create a new dataset called mp2 that is the same as mp1b:
“mp2<-mp1b”
If h > 0, I want to set create a dataset mp2, where I limit the original dataset to those where mp1b$group = =h. similar to:
2006 Oct 12
1
Should NA's in summary() output always be reported???
Consider
> summary(1:5)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1 2 3 3 4 5
> summary(c(1:5,NA))
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
1 2 3 3 4 5 1
Wouldn't it be more stringent if "NA's" was also reported in the first case??
Regards
S?ren
2005 Dec 14
2
The fastest way to select and execute a few selected functions inside a function
Dear useRs?
I have the following problem! I have a function that calls one or more
functions, depending on the input parameters. I am searching for the fastest
way to select and execute the selected functions and return their results in
a list. The number of possible functions is 10, however usually only 2 are
selected (although sometimes more, even all).
For examples, if I have function
2005 Dec 07
4
Maintaining factors when copying from one data frame to another
Greetings all:
OK, this is bugging the @#@%* out of me. I know the answer is simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
encountered this in the past). My problem is:
I have a data frame with columns A, B, C, D, and E. A, B, and E are
factors and C and D are numeric. I need a new data frame with
2006 Sep 29
3
if then else
What is the correct form to write statement meaning:
if (a==1) {b=2; c=3}; else {b=0; c=0};
Thank you
Jue Wang, Biostatistician
Contracted Position for Preclinical & Research Biostatistics
PrO Unlimited
(908) 231-3022
2006 Oct 05
1
matrix multiplication
Dear all,
I have 2 matrices, one is a 8x3 matrix, called X; the other matrix is a 3x3 indicator matrix with the diagonal element as 0 or 1. when a variable is included in the model, the corresponding diagonal element is 1, otherwise, it is 0. Let A be a set of matrices that contain the possible indicator matrix. e.g.,
A= [A1, A2, A3],
where A1= [1,0,0;0,0,0,0,0,0],
A2 =[1,0,0;0,1,0,0,0,0],
A3
2006 Oct 05
1
convert day of week from number to character and include in lm
All,
I am trying to include a day of week variable (1-7) in in a regression
model. I would like to have the day of week treated as a categorical
variable rather than a number
the code looks like
lm( dep ~ WKDY)
I know this is a basic question, but help would be appreciated
thanks
spencer
[[alternative HTML version deleted]]
2006 Oct 11
1
extracting rows
Hi,
I have a matrix with few hundred by a few hundred and want to extract rows,
e.g. (0,1,0), or (1.3, 2.4, 4). I made an example:
> A = rep(rep(c(0,1),4),2)
> B = rep(rep(c(0,1),each=4),2)
> C = rep(rep(rep(c(0,1),2),each=2),2)
> X = data.frame(A,B,C,rnorm(16))
A B C
[1,] 0 0 0 0.72767870
[2,] 1 0 0 -0.09673298
[3,] 0 0 1 0.51192790
[4,] 1 0 1 -1.54350441
[5,] 0 1 0
2006 Jul 13
3
set the bahavior that R deal with missing values?
Dear Rusers,
The default behavior in R when performing a regression model with missing
values is to exclude any case that contains a
missing value? How could i set the bahavior that R deal with missing values?
e.g.:
exclude cases listwise
exclude cases pairwise
replace with mean
Thanks very much!
--
Kind Regards,
Zhi Jie,Zhang ,PHD
Department of Epidemiology
School of Public Health
Fudan
2006 Sep 20
5
multiple lines and plot
Hi. Please, how can I put together 2 or more lines at the same
scatterplot ? Example: measures of protein intake (quantitative) of 4
children over 30 days, by day. How to plot all children at same graphic:
Protein X Time ? Is there any command like "overlay" ?
Thank you,
Mauricio
2005 Oct 19
3
npmc package
Hi
Does anyone know where is the package: npmc (Nonparametric Multiple
Comparisons).
I found the reference on R Site Search, but not the package itself on
CRAN as suggested.
Thanks
Mauricio
2007 Jan 25
7
filling the area
Please, how to fill the area under the curve?
x <- c(1:10)
y <- c(rnorm(10))
plot(x,y)
lines(x,y)
Thanks,
Mauricio Cardeal
2006 Jul 11
2
new object
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20060711/1da40382/attachment.pl
2005 Sep 13
11
if() command
Hi everyone !
Could you please help me with this problem ?
I??ve trying to write a code that assign to a variable the content from
another, but all I??ve got is a message error. For example:
if (age <=10) {group == 1}
else if (age > 10 & age <= 20) {group == 2}
else {group == 3}
Syntax error
Or
if (age <=10) {group == 1}
else (age > 10 & age <= 20) {group == 2}
2004 Feb 29
7
Proportions again
Hello.
I asked before and it was great, cause as a beginner I learned a lot. But, if I have this in R (1 and 2 are codes for sex):
> sex<-c(1,2,2,1,1,2,2,2)
> sex
[1] 1 2 2 1 1 2 2 2
I´d like to obtain the proportion according to sex.So I type:
> prop.table(sex)
[1] 0.07692308 0.15384615 0.15384615 0.07692308 0.07692308 0.15384615 0.15384615
[8] 0.15384615
The result is OK, but I
2004 Feb 11
6
lapply and dynamically linked functions
Hi all,
I'm trying to use lapply on a list with the following command:
out<-lapply(mylist,myfun,par1=p,par2=d) (1)
where
myfun<-function(x,par1,par1) {.....} (2)
now this function is in fact a wrapper for some Fortran code I have
written so I think this might be the problem. When I call lapply() as in
(1) I get the following message:
Error in get(x,
2006 Mar 08
6
Debugging a program written in the R language
>From Tom:
The subject is debugging a program written in the R language,under
Windows. (Sorry, but I do not know either the Apple OS or *nix.) A
computer program will usually not work on the first try, if only
because of the risk of typos. Instead, it must be debugged. Roughly,
here is the sequence:
(1) One codes a program using the R language, and stores it on the
hard drive, using
2005 Dec 11
2
Problem with indexing (subscript out of bounds)
Hi,
I am trying to index the rows of a model matrix where, due to missing
values in the dataset used for the regression, the row numbers sometimes
"jump" like this:
> X[17:19,]
(Intercept) PCINIFM
17 1 36.76471
19 1 13.23529
20 1 32.35294
So, the problem is if I select for example X[20, ], I actually get the
21th observation. I've tried to work