jim holtman | 1 Jul 01:01 2006
Picon

Re: Creating Vectors

Does this do what you want?  It creates a 'list' with the vectors:

> x <- 'type count
+   0     20
+   1     15
+    0     10
+   1     35
+   0     28
+ '
> x <- read.table(textConnection(x), header=TRUE)
> x
  type count
1    0    20
2    1    15
3    0    10
4    1    35
5    0    28
> type <- split(x$count, x$type)
> type
$`0`
[1] 20 10 28

$`1`
[1] 15 35

> type[['0']]
[1] 20 10 28
> type[['1']]
[1] 15 35
>
(Continue reading)

Gabor Grothendieck | 1 Jul 01:20 2006
Picon

Re: weird error message

This is FAQ 7.31:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

Also please do not piggy back on other threads since it makes the
archives less useful.

On 6/30/06, Alexander Nervedi <alexnerdy <at> hotmail.com> wrote:
> Hi!
>
> In the example below why is x[[1]] == 0.2237724 false?
>
> Alexander Nervedi
>
>
> >x <- runif(10)
> >x[[1]]
> [1] 0.2237724
>
> >x
> [1] 0.2237724 0.2678944 0.9375811 0.5963889 0.6180519 0.6449580 0.7308510
> [8] 0.7347386 0.4837286 0.1416100
>
> >x[[1]] == 0.2237724
> FALSE
>
>
>
>
>
(Continue reading)

markleeds | 1 Jul 02:50 2006
Picon
Picon

postscript file too large : maybe an R question

i created a postscipt file in R and then i downloaded a free version
of ghostview to view it. unfortunately, i get the message

fata error : dynamic memory exhausted
when i try to view it.

when i do a dir on windows xp, the file size is 149,034,475
and i know there about 17,000 graphs. is there
a way of possibly viewing this size postscript file in R itself ?

                                   Thanks

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

yyan liu | 1 Jul 06:11 2006
Picon

polynomial expansion in R

Hi:
   I have two vectors of data, x and y and I want to get the "polynomial" expansion of (x+y)^p with any integer
power p in R. Suppose p=2, then I want a matrix of five vectors, namely, x y x^2 y^2 x*y. The coefficient of the
polynomial is not needed. I can write it manully if p is small. But I want it in the case of p=10 or even bigger,
is there any function in R can do that automatically for me with certain choice of p?
   Thx a lot!

 liu

 		
---------------------------------

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Shin, David | 1 Jul 07:15 2006

generate bi-variate normal data

Dear all,

I would like to generate bi-variate normal data given that the first column
of the data is known. for example:
I first generate a set of data using the command, 
x <- rmvnorm(10, c(0, 0), matrix(c(1, 0, 0, 1), 2))

then I would like to sum up the two columns of x:
x.sum <- apply(x, 1, sum)

now with x.sum I would like to generate another column of data, say y, that
makes cbind(x.sum, y) follow a bi-variate normal distribution with mean =
c(0, 0) and sigma = matrix(c(1, 0, 0, 1),2)

I will appreciate for all insights.

David s.

**************************************************************************** 
This email may contain confidential material.\ If you were n...{{dropped}}

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

markleeds | 1 Jul 07:27 2006
Picon
Picon

Re: generate bi-variate normal data

>From: "Shin, David" <david.shin <at> pearson.com>
>Date: Sat Jul 01 00:15:21 CDT 2006
>To: "'r-help <at> stat.math.ethz.ch'" <r-help <at> stat.math.ethz.ch>
>Subject: [R] generate bi-variate normal data

it's an interesting question. someone else
on this list can answer more explicitly but
i think you have to use the result for the multivariate
normal distribution ( bivariate case ) where , if the
joint is normal , then the conditional is normal also
with parameters a function of the 2 means and the elements of
the covariance matrix. the result in any decent mathematical statistics such as  casella berger. so, given
the one column, generate the other column conditionally using the formula  and then the joint dist will be
bivariate normal.

>Dear all,
>
>I would like to generate bi-variate normal data given that the first column
>of the data is known. for example:
>I first generate a set of data using the command, 
>x <- rmvnorm(10, c(0, 0), matrix(c(1, 0, 0, 1), 2))
>
>then I would like to sum up the two columns of x:
>x.sum <- apply(x, 1, sum)
>
>now with x.sum I would like to generate another column of data, say y, that
>makes cbind(x.sum, y) follow a bi-variate normal distribution with mean =
>c(0, 0) and sigma = matrix(c(1, 0, 0, 1),2)
>
>I will appreciate for all insights.
(Continue reading)

zhijie zhang | 1 Jul 08:50 2006
Picon

general linear model and generalized linear model

Dear friends,
  I searched the R site and found a lot of results on general linear model
and generalized linear model , and i was confused by them. Here, I only want
to get some concise answers on the following questions and i'll study it by
your hints:
 1. Which function(package) could be used to fit the general linear model ?
2. Which function(package) could be used to fit the generalized linear model
?
3. How to tell them which variables in my dataset are categorical variables
that will be used as dummy variables?
Thanks very much!

--

-- 
Kind Regards,
Zhi Jie,Zhang ,PHD
Department of Epidemiology
School of Public Health
Fudan University
Tel:86-21-54237149

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Ajay Narottam Shah | 1 Jul 08:54 2006

SUMMARY: making contour plots using (x,y,z) data

Folks,

A few days ago, I had asked a question on this mailing list about
making a contour plot where a function z(x,y) is evaluated on a grid
of (x,y) points, and the data structure at hand is a simple table of
(x,y,z) points. As usual, R has wonderful resources (and subtle
complexity) in doing this, and the gurus of the list showed me the
way. Here's a complete working example. One might stumble on contour()
but lattice::contourplot() fits this task better since the former
requires a certain unusual data representation, while
lattice::contourplot() wants a more natural data representation.

            -ans.

# Setup an interesting data matrix of (x,y,z) points:
points <- structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05,
0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25,
0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 
 0.4, 0.4, 0.4, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.!
 45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5, 0.5, 0.5, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.55,
0.55, 0.55, 0.55, 0.55, 0.55, 0.55, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6,
0.6, 0.6, 0.6, 0.6, 0.6, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.65,
0.65, 0.65, 0.65, 0.65, 0.65, 0.65, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7,
(Continue reading)

Tobias Verbeke | 1 Jul 10:58 2006
Picon

Re: general linear model and generalized linear model

>----- Oorspronkelijk bericht -----
>Van: zhijie zhang [mailto:epistat <at> gmail.com]
>Verzonden: zaterdag, juli 1, 2006 08:50 AM
>Aan: r-help <at> stat.math.ethz.ch
>Onderwerp: [R] general linear model and generalized linear model
>
>Dear friends,
>  I searched the R site and found a lot of results on general linear model
>and generalized linear model , and i was confused by them. Here, I only want
>to get some concise answers on the following questions and i'll study it by
>your hints:
> 1. Which function(package) could be used to fit the general linear model ?

Function lm from the stats package (which comes with R).
See ?lm

>2. Which function(package) could be used to fit the generalized linear model
>?

Function glm from the stats package.
See ?glm

Chapter 11 of `An Introduction to R' (which comes with R and 
is available on CRAN) is devoted to statistical models in R
and has sections on linear models and generalized linear models.
Cf. http://cran.r-project.org/manuals.html

>3. How to tell them which variables in my dataset are categorical variables
>that will be used as dummy variables?

(Continue reading)

Simon Wood | 1 Jul 15:47 2006
Picon

Re: getting the smoother matrix from smooth.spline

maybe not directly, as it's returning the hat/influence/smoother matrix 
rather than the model/design matrix itself... however a similar trick 
which manipulated the `fit$coef' component of a single spline fit and then 
predicted from this at the x values would be one way of extracting the 
model matrix.

> Perhaps this could be developed into a spline smooth method
> for model.matrix and included in R.
>
> On 6/30/06, Simon Wood <sw283 <at> maths.bath.ac.uk> wrote:
>> smooth.matrix = function(x, df){
>>  n = length(x);
>>  A = matrix(0, n, n);
>>  for(i in 1:n){
>>        y = rep(0, n); y[i]=1;
>>        yi = predict(smooth.spline(x, y, df=df),x)$y;
>>        A[,i]= yi;
>> }
>>  (A+t(A))/2;
>> }
>> 
>> 
>> >- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>> >-             +44 (0)1225 386603         www.maths.bath.ac.uk/~sw283/
>> 
>> 
>> On Sat, 24 Jun 2006, Gregory Gentlemen wrote:
>> 
>> > Can anyone tell me the trick for obtaining the smoother matrix from 
>> smooth.spline when there are non-unique values for x. I have the following 
(Continue reading)


Gmane