This has all the hallmarks of a bug I found and fixed in R-devel
(r46998). I did not port the patch over to the R release branch because
I could not reproduce the bug.
In R-devel, I was seeing problems with make test-Segfault. This would
occasionally segfault, but most of the time would create
Deer Meir,
You could take a look at lroc() from epicalc package.
Or calculate all that yourself : the linear fit of the model are in
yourmodel$linear.predicators
Best regards,
david
2008/12/18 Meir Preiszler pm...@itamar-medical.com
Hi,
Assume I have a variable Y having two discrete values
JK == John Kerpel john.ker...@gmail.com
on Tue, 16 Dec 2008 13:26:27 -0600
JK DTB6-alignDailySeries(DTB6, method = interp,include.weekends = FALSE,
JK units = NULL)
JK Error in getDataPart(S4 object of class timeSeries) :
JK no '.Data' slot defined for class timeSeries
JK
Maybe this is more of a statistical question than an R question, but I am
going to ask it anyway :) Cortisol and Testosteron are known to interact in
the body, and some literature suggest that especially the ratio between the
two is a good predictor. So I want to add the ratio predictor
Are you sure that you have all your packages updated? Because qplot(mpg, wt,
data=mtcars) works without a problem on my machine. Please add the info of
sessionInfo() when reporting bugs. The posting guide asked you to do so.
Thierry
sessionInfo()
R version 2.8.0 (2008-10-20)
i386-pc-mingw32
Dear all,
after recently updating my R-packages I am unable to work with lme4,
since it does not load. What I get is this:
Error in inDL(x, as.logical(local), as.logical(now), ...) :
function 'cholmod_l_start' not provided by package 'Matrix'
In addition: Warning messages:
1: package 'lme4'
I have two date objects
X - c(01-03-1993, 01-05-1997) #Mar 1993 and May 1997
Y - c(01-02-1995, 01-08-1999) #Feb 1995 and Aug 1999
and a time series object
A - ts(rnorm(120), freq=12, start=c(1992,8)) #Aug 1992 to Aug 2002
I want to create a binary (0-1) vector B that is of length 1:(A).
B
Thanks so much everyone, these suggestions solve my problem in a very elegant
way.
A friend and I also came up with this brute force solution:
T - c(1993m10)
y - gsub(m., , T)
m - gsub(.*m, , T)
d - paste(y,-0,m,-,01, sep=)
T - as.Date(d, format=%Y-%m-%d)
Thought I would post it in any case.
zack holden wrote:
Dear list,
I would like to plot 2 series of numbers with very different
ranges/scales as lines on the same
plot. I assumed this is commonly done and easy, but I have not found
any help files (e.g. axis()
or matplot() that show how. I've searched many old posts to no
Dear Rüdiger,
Try to uninstall AND fysically remove (delete) lme4 and Matrix from the
harddisk. Then installing them again should do this trick. At least it did on
my laptop.
HTH,
Thierry
ir. Thierry Onkelinx
Dear all,
I would like to draw a 3-D horizontal cylinder preferably in RGL device
(because this gives the look from different angles). Basic idea is from
http://www.tau.ac.il/cc/pages/docs/sas8/insight/chap18/sect3.htm.
Below is the description exactly what I want to do.
Please see at figure
Wow, thats amazing, thanks very much!!!
Simon.
- Original Message -
From: Henrique Dallazuanna
To: Simon Pickett
Cc: r-help@r-project.org
Sent: Thursday, December 18, 2008 11:25 AM
Subject: Re: [R] inserting zero instances with zeroes in a matrix
Try this:
I'm looking for a function or algorithm for calculating McCall's area
transformed T-scores, but have not find any. An algorithm is described
on http://www.visualstatistics.net/Visual Statistics
Multimedia/normalization.htm, but this seem to be an overly
complicated procedure for implementing in R.
Hi Fredrik,
well I'm connecting via SSH onto the machine. Lateron the R scripts
shall be executed via some Ruby scripts. The pdf export is working
properly, but I think it would be very ugly to first create a pdf file
and then convert it to my needed png (or any other pure image format).
Try this:
as.data.frame(xtabs(count ~., d.f))
On Thu, Dec 18, 2008 at 6:25 AM, Henrique Dallazuanna www...@gmail.com wrote:
Try this:
with(d.f,
{merge(data.frame(house = rep(unique(house), each =
length(unique(pet))),
pet = unique(pet)), d.f, by = c(house, pet), all = TRUE)
Try this:
with(d.f,
{merge(data.frame(house = rep(unique(house), each =
length(unique(pet))),
pet = unique(pet)), d.f, by = c(house, pet), all = TRUE)
}
)
On Thu, Dec 18, 2008 at 8:58 AM, Simon Pickett simon.pick...@bto.orgwrote:
Hi all,
Suppose I had the below
Thanks Gregor and Henrique for the eloquent and masterful replies,
These solutions have saved me hours (maybe even days) of work in the future,
I am very grateful. :-)
Simon.
- Original Message -
From: Gabor Grothendieck ggrothendi...@gmail.com
To: Henrique Dallazuanna
No, haven't seen this so far. But it quite looks like what I'm looking
for, so thanks a lot :-)
Dennis
Am 18.12.2008 um 13:09 schrieb Fredrik Karlsson:
Hi again,
Sorry for bothering you, but have you seen this?
http://www.stats.bris.ac.uk/R/web/packages/GDD/index.html
or this one
Hi R helpers,
Is there any function in R, which generates random numbers in case of
(1) Generalized Extreme Value distribution and
(2) Generalized PAreto distribution for the respective given set of parameters?
Regards
Maithili
__
Dear List:
I encountered this strange problem. I want to read dates in a R program.
This is a sample data:
Dates
12/12/08
14/12/08
18/01/08
28/02/08
16/06/08
19/07/08
28/09/08
If I save these dates in a .csv file, and read it in R using read.csv, I
can perfectly read the data, and the commands
Yep, that was it. I had an out of date plyr. Hadley straightened me out.
- Tom
-Original Message-
From: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be]
Sent: Thursday, December 18, 2008 5:03 AM
To: Short, Tom; r-help@r-project.org
Subject: RE: [R] Problem with ggplot2
Are you
I have two date objects
X - c(01-03-1993, 01-05-1997) #Mar 1993 and May 1997
Y - c(01-02-1995, 01-08-1999) #Feb 1995 and Aug 1999
and a time series object
A - ts(rnorm(120), freq=12, start=c(1992,8)) #Aug 1992 to Aug 2002
I want to create a binary (0-1) vector B that is of length 1:(A).
2008/12/18 Dennis Schmidt dennis.schm...@student.hpi.uni-potsdam.de:
No, haven't seen this so far. But it quite looks like what I'm looking for,
so thanks a lot :-)
The png() device does not need an X server to connect to. I think it
used to in versions gone by, but not any more. Here I've
megh wrote:
Dear all,
I would like to draw a 3-D horizontal cylinder preferably in RGL device
(because this gives the look from different angles). Basic idea is from
http://www.tau.ac.il/cc/pages/docs/sas8/insight/chap18/sect3.htm.
Below is the description exactly what I want to do.
Please
Hi,
I have spatially autocorrelated data (with a binary response variable and
continuous predictor variables). I believe I need to do an autologistic
model, does anyone know a method for doing this in R?
Many thanks
C Bell
__
R-help@r-project.org
Thanks Gabor.
Just tried that... it didn't work for some reason, even though it also did
not complain about an error this time.
x[as.Date(2008-12-14)]
2008-12-14
NA
x[as.Date(2008-12-14)]-1
x[as.Date(2008-12-14)]
2008-12-14
NA
Regards,
Tolga
Tolga Uzuner
Hello,
did you try to replace the print commands with HTML?
But first you have to specify a file through HTMLStart and at the end of the
function HTMLStop.
Including plots is no problem, but you have to save them and then with the
HTMLInsertGraph function insert them into your report.
Kind
Dear Maithili,
For (1) see [1] and for (2) see page 24 in [2].
HTH,
Jorge
[1] http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/evd/html/gev.html
[2] http://cran.r-project.org/web/packages/fExtremes/fExtremes.pdf
On Thu, Dec 18, 2008 at 3:17 AM, Maithili Shiva
I didn't notice the second question and was only
answering your first question:
library(zoo)
x - zoo(c(361.667, 389.875, NA, NA, 397.822, 395.667), as.Date(2008-12-11)
+ 0:5)
x[as.Date(2008-12-14)]
2008-12-14
NA
For the second question use window (window also works for the first
Hi Barry,
this is the output of my capabilities() call:
jpeg png tifftcltk X11 aqua http/ftp sockets
FALSEFALSEFALSEFALSEFALSEFALSE TRUE TRUE
libxml fifo clediticonv NLS profmemcairo
TRUE TRUE TRUE TRUE
Convert the date column to Date class and then
access that column, not the entire data frame:
library(gdata)
Dates - read.xls(/tmp2/date.xls, header = FALSE)
Converting xls file to csv file... Done.
Reading csv file... Done.
months(as.Date(Dates[[1]], %m-%d-%y))
[1] December December January
Please start a new thread for a new topic and use a
meaningful subject for sake of the archives and
everyone trying to follow.
Using your Int1, correcting your Int2 and using your
Y (which goes to Jul not Aug as per the comment):
library(zoo)
as.ts(with(merge.zoo(Int1, Int2, Y, fill = 0),
My initial comment was wrong. I see that this is really
an answer rather than the question but it was confusing
because it started a new thread. Please try to use the
same thread in answering the question.
On Thu, Dec 18, 2008 at 9:39 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Please
Actually,
Both these solutions create contingency tables, with frequency rather than
the original count values. Is there a way to retain the original count
values?
Thanks again, Simon.
- Original Message -
From: Simon Pickett simon.pick...@bto.org
To: Gabor Grothendieck
It does retain the original count values. Its only the column name
that has changed. To change that you can use:
as.data.frame(xtabs(count ~., d.f), responseName = count)
# compare
d.f[order(d.f$house, d.f$pet), ]
house pet count
2 house1cats 1
1 house1dogs 2
3 house2
Hi,
On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
... but this is also legal if you really hate - :
foo({x = 2})
# assign to x, pass to foo as a
This is legal but doesn't do what you probably expect -- although
documentation for `-` says
A good article to read before using ratios is:
Kronmal, RA. Spurious Correlation and the Fallacy of the Ratio Standard
Revisited. Journal of the Royal Statistical Society. Series A, Vol 156, No. 3
(1993), 379-392.
It shows some of the traps that misusing ratios can lead to along with
Hi,
I've simplified the bouncing off part as choosing another place to
go (with no consideration of the bouncing details):
##
set.seed(1234)
par(pty = s, pch = 19, ann = FALSE, xaxt = n,
yaxt = n, bty = n)
theta = seq(0, 2 * pi, length = 512)
n = 20
nmax = 500
x = runif(n, -1, 1)
y =
On Thu, Dec 18, 2008 at 08:31:09AM -0600, Dirk Eddelbuettel wrote:
On Thu, Dec 18, 2008 at 02:52:40PM +0100, Dennis Schmidt wrote:
Hi Barry,
this is the output of my capabilities() call:
jpeg png tifftcltk X11 aqua http/ftp sockets
FALSEFALSEFALSE
that was able to work. Thank you!
its a little clumsy in getting a certain view, but you can get to it
eventually.
Is their a way to do it with plot3d so that you can use the mouse to rotate the
surface plot around?
Brad
Date: Wednesday, December 17, 2008, 10:09 AM
Look at rotate.wireframe
On Thu, Dec 18, 2008 at 5:26 PM, Peter Dalgaard p.dalga...@biostat.ku.dkwrote:
bar - foo({x = 42})
bar
[1] 42
What you're seeing is effectively
foo(invisible(42))
i.e. the result is there, just not printing.
Thanks for explaining. This is cleverer and much less obscure than I
Dear Irina,
Some more information might help: Which plug-in package? What OS? What are
the errors?
You might try the development version of the Rcmdr package on R-Forge, which
makes some changes to the handling of plug-ins, and which can be installed
via
Hello,
I try to incorporate C code in R.
suppose I have the following C code:
#include R.h
#include stdio.h
int main(int *n)
{
int i;
for(i=0; i *n; i++) {
printf(Hello, world!\n);
}
}
in a file named hello.c. First I make:
g++ -c hello.c -o hello.o -I
On Thu, 2008-12-18 at 17:18 +0100, Thibault Helleputte wrote:
Hello,
I try to incorporate C code in R.
suppose I have the following C code:
#include R.h
#include stdio.h
int main(int *n)
{
int i;
for(i=0; i *n; i++) {
printf(Hello, world!\n);
}
}
in a
Dear list,
I am using svyglm in the survey library to fit a binomial logistic
regression accounting for sample design. The documentation says the
models are not fit by maximum likelihood, so my question is what is
the fitting method? Pseudo likelihood? Generalized least squares?
All -
I have a number of rows that I am assigning length classes to via
l.class-with(wae,
ifelse((Length=120)(Length130),125,
ifelse((Length=130)(Length140),135,
ifelse((Length=140)(Length150),145,
ifelse((Length=150)(Length160),155,
ifelse((Length=160)(Length170),165,
SR,
My answer to the question you posed is Someone must know, but I do not
know.
However, I suspect the answer to the question you should have asked is:
See
?cut
and
?findInterval
HTH,
Chuck
On Thu, 18 Dec 2008, Ranney, Steven wrote:
All -
I have a number of rows
On 12/18/2008 12:00 PM, Ranney, Steven wrote:
All -
I have a number of rows that I am assigning length classes to via
l.class-with(wae,
ifelse((Length=120)(Length130),125,
ifelse((Length=130)(Length140),135,
ifelse((Length=140)(Length150),145,
ifelse((Length=150)(Length160),155,
Hi there
I am new to R and would like to ask some questions which might not make
perfect sense. Anyhow, here they are:
1) I would like very much to use R for processing some big data files
(around 1.7 or more GB) for spatial analysis, wavelets, and power
spectra estimation; is this possible
Kenn Konstabel wrote:
Hi,
On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
... but this is also legal if you really hate - :
foo({x = 2})
# assign to x, pass to foo as a
This is legal but doesn't do what you probably expect --
Kenn Konstabel wrote:
If you really hate -, you should do either
foo({(x=42)}) # or
foo({x=42; x}) # or even ...
foo(a=force(x=43))
if you think the use of force guarantees that x is assigned 43, you're
wrong.
foo = function(a) 0
x = 1
foo(a=force(x=2))
x
foo = function(a)
Wacek Kusnierczyk wrote:
Kenn Konstabel wrote:
Hi,
On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
... but this is also legal if you really hate - :
foo({x = 2})
# assign to x, pass to foo as a
This is legal
I am trying to define an S4 class that contains a ts class object, a
simple
example is shown in the code below. However, when I try to create a new
object
of this class the tsp part is ignored, see below. Am I doing something
wrong,
or is this just a peril of mixing S3 and S4 objects?
Hi Mauricio,
Mauricio Calvao schrieb:
1) I would like very much to use R for processing some big data files
(around 1.7 or more GB) for spatial analysis, wavelets, and power
spectra estimation; is this possible with R? Within IDL, such a big data
set seems to be tractable...
There are some
Hi, I'm trying to connect to a Teradata database via RODBC on a Linux 64
machine (Red Hat Enterprise Linux 5). The ODBC driver is properly
configured and queries sent via unixODBC's isql tool work properly. However,
this is what happens when I try to connect via RODBC:
library(RODBC)
conn =
I seem to have solved this on my own:
t.score.table - data.frame(T=10:90,F=pnorm(10:90,mean=50.5,sd=10))
t.score - function(x) {
p - ecdf(x)
t - cut(p(x),breaks=c(t.score.table$F,Inf),labels=t.score.table$T)
t - as.numeric(levels(t))[as.integer(t)]
return(t)
}
/S
2008/12/18 Stefan Björk
On Dec 18, 2008, at 3:07 PM, Stephan Kolassa wrote:
Hi Mauricio,
Mauricio Calvao schrieb:
1) I would like very much to use R for processing some big data
files (around 1.7 or more GB) for spatial analysis, wavelets, and
power spectra estimation; is this possible with R? Within IDL, such
On Thu, 18 Dec 2008, Francisco Javier Perez Caballero wrote:
Hi, I'm trying to connect to a Teradata database via RODBC on a Linux 64
machine (Red Hat Enterprise Linux 5). The ODBC driver is properly
configured and queries sent via unixODBC's isql tool work properly. However,
this is what
Hey,
Have some one work with End-Member Mixing Analysis in R? Is there a
specific package?
Thanks,
Alex
--
Alexandre Swarowsky
Soils and Biogeochemistry Graduate Group
University of California at Davis
One Shields Avenue
Davis CA 95618
Office: (530)752-4131
cell: (530)574-3028
When executing the command:
print(cat(paste(Input criteria does not meet specifications. Check
input against the following requirements:
a = 0
b = 0
c = 0 , sep=), ))
I get:
Input criteria does not meet specifications. Check input against the
following
Dear Brigid,
cat() prints by default to standard output and invisibly returns NULL, which
print() prints. I think that what you want is
cat(Input criteria do not meet specifications. Check input against the
following requirements:
a = 0
b = 0
c = 0 \n)
I
I'm trying to understand the use of recursive functions described on page
45 of An Introduction to R by the R core development team.
A function is a list of expressions, which all get executed with only the
last being assigned to a global variable, right?
So if a function refers recursively to
joseph.g.bo...@gsk.com wrote on 12/18/2008 04:22 PM:
I'm trying to understand the use of recursive functions described on page
45 of An Introduction to R by the R core development team.
A function is a list of expressions, which all get executed with only the
last being assigned to a global
On 18-Dec-08 22:33:28, Jeffrey Horner wrote:
joseph.g.bo...@gsk.com wrote on 12/18/2008 04:22 PM:
I'm trying to understand the use of recursive functions described
on page 45 of An Introduction to R by the R core development team.
A function is a list of expressions, which all get executed
All,
Thanks for all of your help advice! I created a plot starting with
qqnorm, if I remember right, but I had to add a LOT of extras. I was
surprised that it doesn't include the probability (e.g. 50% at mean) and
instead provides the standard deviations (e.g., 0 at mean) on the axis.
Jeffrey Horner wrote:
joseph.g.bo...@gsk.com wrote on 12/18/2008 04:22 PM:
I'm trying to understand the use of recursive functions described on
page 45 of An Introduction to R by the R core development team.
A function is a list of expressions, which all get executed with only
the last being
On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Kenn Konstabel wrote:
...foo({x = 2})
...
This is legal but doesn't do what you probably expect -- although
documentation for `-` says the value (returned by -) is 'value' i.e.
whatever is
Wacek Kusnierczyk wrote:
it's a pity that - is not explained in ?`-` clearly enough:
The operators '-' and '-' cause a search to made through the
environment for an existing definition of the variable being
assigned. If such a variable is found (and its binding is not
Stavros Macrakis wrote:
On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Kenn Konstabel wrote:
...foo({x = 2})
...
This is legal but doesn't do what you probably expect -- although
documentation for `-` says the
Stavros Macrakis wrote:
On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Kenn Konstabel wrote:
...foo({x = 2})
...
This is legal but doesn't do what you probably expect -- although
documentation for `-` says the value (returned by -) is
Wacek Kusnierczyk wrote:
Wacek Kusnierczyk wrote:
it's a pity that - is not explained in ?`-` clearly enough:
The operators '-' and '-' cause a search to made through the
environment for an existing definition of the variable being
assigned. If such a variable is found (and its
Stavros Macrakis wrote:
On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
who said = is more intuitive for assignments? i said i prefer it, and
that's because of aesthetics, silly me. in an earlier post, someone
said it is more natural
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of
ted.hard...@manchester.ac.uk
Sent: Thursday, December 18, 2008 2:52 PM
To: r-help@r-project.org
Cc: joseph.g.bo...@gsk.com
Subject: Re: [R] understanding recursive functions
Hi,
When I plot multi-panel in R by using lattice package,
the order is always starting from bottom to the top,
e.g., panel 1,2,3,4 will looks like the following,
3,4
1,2
How can I change it to
1,2
3,4
?
many thanks!
Best,
Haoda
__
On 19/12/2008, at 2:03 PM, Haoda Fu wrote:
Hi,
When I plot multi-panel in R by using lattice package,
the order is always starting from bottom to the top,
e.g., panel 1,2,3,4 will looks like the following,
3,4
1,2
How can I change it to
1,2
3,4
?
many thanks!
Use the ``as.table''
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Nordlund,
Dan (DSHS/RDA)
Sent: Thursday, December 18, 2008 5:00 PM
To: r-help@r-project.org
Subject: Re: [R] understanding recursive functions
-Original Message-
Is there a way a function ('parent', say) can manipulate the ... argument,
and then pass the manipulated value into another function ('child', say)
that it calls?
What I'm trying to do is to use some plotting defaults within 'parent' that
are not part of parent's argument list, but to let the
Hi R-experts,
I want to use the jackknife function from the bootstrap package onto a
linear model.
I can't figure out how to do that. The manual says the following:
# To jackknife functions of more complex data structures,
# write theta so that its argument x
# is the set of observation
Is there a way a function ('parent', say) can manipulate the ...
argument, and then pass the manipulated value into another function
('child', say) that it calls?
What I'm trying to do is to use some plotting defaults within 'parent'
that are not part of parent's argument list, but to let
2008/12/18 joseph.g.bo...@gsk.com:
I am trying to understand the concept of lexical scope in An Introduction
to R by the R Core development team.
I'd appreciate it if someone would explain why the following example does
not work:
q - function(y) {x + y}; w - function(x){q(x)}; w(2);
On 18/12/2008 7:19 PM, Dan Kelley wrote:
Is there a way a function ('parent', say) can manipulate the ... argument,
and then pass the manipulated value into another function ('child', say)
that it calls?
What I'm trying to do is to use some plotting defaults within 'parent' that
are not part of
Hi Charlotte,
I suggest you give a look ate Hmisc and Design packages.
May be there you can find some solution.
Good luck
miltinho,
brazil
...User R!...
On Thu, Dec 18, 2008 at 10:14 AM, Charlotte Bell
charlotte.b...@sheffield.ac.uk wrote:
Hi,
I have spatially autocorrelated data (with a
Here is an example of some code that might do it for you::
input - readLines(textConnection(19
c:/data/WF-100/2008/20080911/trk/20080911.013115.007.17.txt
+ 10 s name of program that wrote this file trkplt name of program
that wrote this file
+ 10 GORDON machine that generated this file
On Thu, 18 Dec 2008, Corey Sparks wrote:
Dear list,
I am using svyglm in the survey library to fit a binomial logistic regression
accounting for sample design. The documentation says the models are not fit by
maximum likelihood, so my question is what is the fitting method? Pseudo
On Thu, 18 Dec 2008 joseph.g.bo...@gsk.com wrote:
I am trying to understand the concept of lexical scope in An Introduction
to R by the R Core development team.
I'd appreciate it if someone would explain why the following example does
not work:
q - function(y) {x + y}; w - function(x){q(x)};
Because I had too much time on my hands, here's a little function that
will do whatever you want over a window you specify. No, I haven't done
any time trials :-(
# my own boxcar tool, just because.
# use bfunc to specify what function to apply to the windowed
# region.
boxcar-function(x,
The definition of jackknife implies that the result of theta must be a
numeric scalar. So, presuming you wanted to jackknife a coefficient,
theta would need to be something like:
theta - function(x, xdata, coefficient) coef(lm(model.lm,
data=xdata[x,]))[coefficient]
and would be called something
I am trying to generate a set of data points from a Gaussian mixture
model. My mixture model is represented by a data frame that looks
like this:
gmm
weight mean sd
10.30 1.0
20.2 -2 0.5
30.44 0.7
40.15 0.3
I have written the following function that generates
Hi,
I encountered an error of type 'C stack usage is too close to the limit', and
could not find information so far to get unstuck. The error occurs when
subsetting columns from a data frame (see stack trace below). However if I
step through the sequence of code found in the 'topmost'
Hi,
I encountered an error of type 'C stack usage is too close to the limit', and
could not find information so far to get unstuck. The error occurs when
subsetting columns from a data frame (see stack trace below). However if I
step through the sequence of code found in the 'topmost'
Your code will always generate the same number of samples from each of
the normals specified on every call, where the number of samples from
each is (roughly) proportional to the weights column. If the weights
column in your data frame represents probabilities of draws coming
from each
... actually, the scaling of the weights was not required as it is
done by sample anyway.
On Fri, Dec 19, 2008 at 5:16 PM, Simon Knapp sleepingw...@gmail.com wrote:
Your code will always generate the same number of samples from each of
the normals specified on every call, where the number of
I think this should work
rgmm - function(n, gmm) {
M - sample(1:4, n, replace = TRUE, prob= gmm$weight)
mean - gmm[M, ]$mean
sd - gmm[M, ]$sd
return(gmm[M,]$sd*rnorm(n) + gmm[M,]$mean)
}
hist(rgmm(1, gmm), breaks = 500)
On Dec 19, 4:14 pm, Bill McNeill (UW)
93 matches
Mail list logo