Displaying 20 results from an estimated 10000 matches similar to: "translating R code to C code"
2008 Oct 13
4
Fw: Logistic regresion - Interpreting (SENS) and (SPEC)
Dear Mr Peter Dalgaard and Mr Dieter Menne,
I sincerely thank you for helping me out with my problem. The thing is taht I already have calculated SENS = Gg / (Gg + Bg) = 89.97%
and SPEC = Bb / (Bb + Gb) = 74.38%.
Now I have values of SENS and SPEC, which are absolute in nature. My question was how do I interpret these absolue values. How does these values help me to find out wheher my model is
2009 Mar 14
4
persp plot + plotting grid lines
Dear all;
Does anyone know how to add grid lines to a persp plot? I've tried
using lines(trans3d..) but the lines of course are superimposed into
the actual 3d surface and what I need is something like the plot shown
in the following link:
http://thermal.gg.utah.edu/tutorials/matlab/matlab_tutorial.html
I'll appreciate any ideas
Thanks
PM
2009 Jan 18
2
don't print object attributes on screen
Dear all;
I have a function written in R that returns as a list of values as
output that has associated some user defined attributes to it. How can
hide these attributes when printing the output on screen? I'm using
R-2.8.1 on WinXP....it's like hiding the attr of the output from the
scale function....
Thanks in advance
PM
2008 Sep 27
10
FW: logistic regression
Sorry.
Let me try again then.
I am trying to find "significant" predictors" from a list of about 44
independent variables. So I started with all 44 variables and ran
drop1(sep22lr, test="Chisq")... and then dropped the highest p value from
the run. Then I reran the drop1.
Model:
MIN_Mstocked ~ ORG_CODE + BECLBL08 + PEM_SScat + SOIL_MST_1 +
SOIL_NUTR + cE + cN +
2016 Apr 02
3
apply mean function to a subset of data
Dear all;
This must have a rather simple answer but haven't been able to figure it
out: I have a data frame with say 2 groups (group 1 & 2). I want to select
from group 1 say "n" rows and calculate the mean; then select "m" rows from
group 2 and calculate the mean as well. So far I've been using a for loop
for doing it but when it comes to a large data set is
2007 Mar 20
2
Translating code from R into Matlab code
Hi,
Correct me if I am wrong but can I translate the R code into Matlab via
this package. ie I have a script in R, if I run this package on a Unix
emulator can I get the R code displayed in Matlab format ( R code
changed into Matlab code). If that is possible that would be great and
if so how. Also, If this program cannot do this do you know one that can
do this:
Regards,
James Flood
2016 Apr 03
1
apply mean function to a subset of data
Here are several ways to get there, but your original loop is fine once it is corrected:
> for (i in 1:2) smean[i] <- mean(toy$diam[toy$group==i][1:nsel[i]])
> smean
[1] 0.271489 1.117015
Using sapply() to hide the loop:
> smean <- sapply(1:2, function(x) mean((toy$diam[toy$group==x])[1:nsel[x]]))
> smean
[1] 0.271489 1.117015
Or use head()
> smean <- sapply(1:2,
2016 Apr 02
0
apply mean function to a subset of data
Hi Pedro,
This may not be much of an improvement, but it was a challenge.
selvec<-as.vector(matrix(c(nsel,unlist(by(toy$diam,toy$group,length))-nsel),
ncol=2,byrow=TRUE))
TFvec<-rep(c(TRUE,FALSE),length.out=length(selvec))
toynsel<-rep(TFvec,selvec)
by(toy[toynsel,]$diam,toy[toynsel,]$group,mean)
Jim
On 4/3/16, Pedro Mardones <mardones.p at gmail.com> wrote:
> Dear all;
>
2007 Jun 14
4
question about formula for lm
Dear all;
Is there any way to make this to work?:
.x<-rnorm(50,10,3)
.y<-.x+rnorm(50,0,1)
X<-data.frame(.x,.y)
colnames(X)<-c("Xvar","Yvar")
Ytext<-"Yvar"
lm(Ytext~Xvar,data=X) # doesn't run
lm(Yvar~Xvar,data=X) # does run
The main idea is to use Ytext as input in a function, so you just type
"Yvar" and the model should fit....
2007 May 11
3
how to get column/row info from a dist object?
Dear R users;
Is it possible to get the row and column number of a particular entry
in a dist object?
Let's say that I want to find the position of the value 1.1837 (the
last entry on the dist object below), that is [6,3]. Can I get those
values without transforming the object to a matrix?, i.e. working with
the dist object only.
1 2 3
2 0.23935864
2011 Sep 20
5
help in interpreting paired t-test
Dear all;
A very basic question. I have the following data:
************************************************************************************
A <- 1/1000*c(347,328,129,122,18,57,105,188,57,257,53,108,336,163,
62,112,334,249,45,244,211,175,174,26,375,346,153,32,
89,32,358,202,123,131,88,36,30,67,96,135,219,122,
89,117,86,169,179,54,48,40,54,568,664,277,91,290,
2010 Dec 19
2
R.matlab memory use
Hi,
I am trying to load into R a MATLAB format file (actually, as saved by
octave). The file is about 300kB but R complains with a memory
allocation error:
> library(Rcompression)
> library(R.matlab)
Loading required package: R.oo
Loading required package: R.methodsS3
R.methodsS3 v1.2.0 (2010-03-13) successfully loaded. See ?R.methodsS3 for help.
R.oo v1.7.2 (2010-04-13) successfully
2009 Jan 04
1
R/octave/matlab etc.
I'd echo a lot of what has been said about this by the folk who have
been making R work so well. One of the main difficulties is that the
environment of computations affects relative performance. e.g., what
settings did a distro package builder choose. I note that my 3 GHz Dual
Core machine running Ubuntu 8.04 gets
octave 3.0.0
octave:6> tic; a = a + 1; toc
Elapsed time is 0.120027
2006 Mar 25
7
Regexp subexpression
I can't get the PERL subexpression translated to R. Following, for example,
B. Ripley's
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/58984.html
I am using sub, but it looks like an ugly substitute. Assume I want to
extract the first alpha part and the first numeric part, but only if they
are in sequence.
Do I really have to use the sub twice, first extracting the first variable,
then
2009 Apr 06
6
Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Hi there,
I hope I can get advice regarding the calculation of leverage values or
studentized residual values of a non-linear regression model. It seems like
rstudent() does not work on a nls object.
Many thanks in advance!
Best regards,
Xingli
2002 Jul 16
2
r-square for non-linear regression
We have extracted parameters from physiological measurements by fitting
SSlogis-like curves with nlsList and nlme.
We presented residuals plot in a paper, but a referee argues that these
cannot be included (too technical), and r-square values should be given
instead to compare the goodness of fit with those of other authors.
I remember that 30 years ago in my stat 101, I learned that r-square is
2009 Sep 30
5
Condition to factor (easy to remember)
Dear List,
creating factors in a given non-default orders is notoriously difficult to
explain in a course. Students love the ifelse construct given below most,
but I remember some comment from Martin M?chler (?) that ifelse should be
banned from courses.
Any better idea? Not necessarily short, easy to remember is important.
Dieter
data = c(1,7,10,50,70)
levs =
2008 Aug 16
4
Lattice: problem using panel.superpose and panel.groups
Hi. I'm embarking on my first attempt at creating my own panel
function for lattice graphics, and despite all of my online research
and pouring through the documentation, I cannot figure out how to
solve my particular problem. Hopefully, a generous fellow R user can
help.
I have some data that is split into two groups: some "actual" data,
and some simulated data,
2011 Aug 29
2
Saving a graph
I read somewhere that vector graphics such as eps or dpf are more favorable
than alternatives (jpeg, bmp or png) for publication because vector graphics
scale properly when enlarged. However, my problem is that the file generated
from a graph of fixed size is too large (in the order of 10MB) because of
many data points in multiple scatterplots. Any suggestions?
Thanks,
Gang
[[alternative HTML
2010 Mar 20
5
Problem specifying Gamma distribution in lme4/glmer
Dear R and lme4 users-
I am trying to fit a mixed-effects model, with the glmer function in
lme4, to right-skewed, zero-inflated, non-normal data representing
understory grass and forb biomass (continuous) as a function of tree
density (indicated by leaf-area). Thus, I have tried to specify a
Gamma distribution with a log-link function but consistently receive
an error as follows:
>