Displaying 20 results from an estimated 300 matches similar to: "Avoid loop with the integrate function"
2012 Apr 05
1
integrate function - error -integration not occurring with last few rows
Hi,
I am using the integrate function in some simulations in R (tried ver 2.12
and 2.15). The problem I have is that the last few rows do not integrate
correctly. I have pasted the code I used.
The column named "integral" shows the output from the integrate function.
The last few rows have no integration results. I tried increasing the
doses, number of subjects, etc.... this error occurs
2012 Mar 25
2
avoiding for loops
I have data that looks like this:
> df1
group id
1 red A
2 red B
3 red C
4 blue D
5 blue E
6 blue F
I want a list of the groups containing vectors with the ids. I am
avoiding subset(), as it is
only recommended for interactive use. Here's what I have so far:
df1 <- data.frame(group=c("red", "red", "red", "blue",
2003 Apr 28
2
stepAIC/lme problem (1.7.0 only)
I can use stepAIC on an lme object in 1.6.2, but
I get the following error if I try to do the same
in 1.7.0:
Error in lme(fixed = resp ~ cov1 + cov2, data = a, random = structure(list( :
unused argument(s) (formula ...)
Does anybody know why?
Here's an example:
library(nlme)
library(MASS)
a <- data.frame( resp=rnorm(250), cov1=rnorm(250),
cov2=rnorm(250),
2012 Oct 14
1
Problems with coxph and survfit in a stratified model, with interactions
First, here is your message as it appears on R-help.
On 10/14/2012 05:00 AM, r-help-request@r-project.org wrote:
> I?m trying to set up proportional hazard model that is stratified with
> respect to covariate 1 and has an interaction between covariate 1 and
> another variable, covariate 2. Both variables are categorical. In the
> following, I try to illustrate the two problems that
2011 Sep 08
2
ggplot geom_freqpoly() layers ..?
Hi,
I was trying to overlay/combine two freqpoly plots. The sample code below
illustrates the problem. Essentially, I want to do is:
1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2').
Currently, all the lines in Plot 1 have different colours and all the lines
in Plot 2 have different colors. I'd like for all lines in Plot 1 to be
'red' and all the
2005 Oct 05
1
Analyses of covariation with lme() or lm()
Hello all!
I have a problem that calls for a better understanding, than mine, of
how lme() uses the random part of the call.
The dataset consists of eleven field trials (Trial) with three
replicates (Block) and four fertiliser treatments (Treat). Analysing for
example yield with lme() is easy:
m1 <- lme(Yield ~ Treat, data=data,
random =~1| Trial/Block)
giving estimates of
2003 Jun 04
3
Slow ttests in R-devel
Hello ...
I've noticed that some of our Bioconductor code was running drastically
slower under current R-devel vs. current R-patched - one example is below
using a ttest. I have the following snippet of code that demonstrates the
problem while avoiding "real" code that takes an extremely long time to
finish on R-devel:
library(genefilter)
data(eset)
eset$cov1
z <-
2011 Sep 08
1
ggplot2 freqpoly() layers..?
Hi,
I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is:
1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2').
Currently, all the lines in Plot 1 have different colours and all the
lines in Plot 2 have different colors. I'd like for all lines in Plot 1
to be 'red' and all
2012 Jul 06
2
Anova Type II and Contrasts
the study design of the data I have to analyse is simple. There is 1 control group (CTRL) and 2 different treatment groups (TREAT_1 and TREAT_2).
The data also includes 2 covariates COV1 and COV2. I have been asked to check if there is a linear or quadratic treatment effect in the data.
I created a dummy data set to explain my situation:
df1 <- data.frame(
Observation =
2013 Oct 18
1
crr question in library(cmprsk)
Hi all
I do not understand why I am getting the following error message. Can
anybody help me with this? Thanks in advance.
install.packages("cmprsk")
library(cmprsk)
result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function
2008 Aug 18
1
lmer syntax, matrix of (grouped) covariates?
I have a fairly large model:
> length(Y)
[1] 3051
> dim(covariates)
[1] 3051 211
All of these 211 covariates need to be nested hierarchically within a
grouping "class", of which there are 8. I have an accessory vector, "
cov2class" that specifies the mapping between covariates and the 8 classes.
Now, I understand I can break all this information up into individual
2005 Feb 23
1
How to conctruct an inner grouping for nlme random statement?
Hello. Im hoping someone can help with a grouping
question related to the "random=" statement within the
nlme function. How do you specify that some grouping
levels are inner to others? I tried several things,
given below.
Lets say I have a data frame with five variables,
resp, cov1, ran1, ran2, group1, and group 2. The
formula is resp~cov1 + ran1 + ran2, where the ran are
random
2010 Jan 30
2
Questions on Mahalanobis Distance
Hello,
I am a new R user and trying to learn how to implement the mahalanobis
function to measure the distance between to 2 population centroids. I
have used STATISTICA to calculate these differences, but was hoping to learn
to do the analysis in R. I have implemented the code as below, but my
results are very different from that of STATISTICA, and I believe I may not
have interpreted the help
2006 Jul 11
2
Multiple tests on 2 way-ANOVA
Dear r-helpers,
I have a question about multiple testing.
Here an example that puzzles me:
All matrixes and contrast vectors are presented in treatment contrasts.
1. example:
library(multcomp)
n<-60; sigma<-20
# n = sample size per group
# sigma standard deviation of the residuals
cov1 <- matrix(c(3/4,-1/2,-1/2,-1/2,1,0,-1/2,0,1), nrow = 3, ncol=3, byrow=TRUE,
dimnames =
2024 Oct 04
1
apply
On 10/4/2024 5:13 PM, Steven Yen wrote:
> Pardon me!!!
>
> What makes you think this is a homework question? You are not
> obligated to respond if the question is not intelligent enough for you.
>
> I did the following: two ways to calculate a covariance matrix but
> wonder how I might replicate the results with "apply". I am not too
> comfortable with the
2012 Aug 27
1
interpret the importance output?
> importance(rfor.pdp11_t25.comb1,type=1)
%IncMSE
v1 -0.28956401263
v2 1.92865561147
v3 -0.63443929130
v4 1.58949137047
v5 0.03190940065
I wasn't entirely confident with interpreting these results based on the
documentation.
Could you please interpret?
[[alternative HTML version deleted]]
2024 Oct 04
1
apply
Pardon me!!!
What makes you think this is a homework question? You are not obligated
to respond if the question is not intelligent enough for you.
I did the following: two ways to calculate a covariance matrix but
wonder how I might replicate the results with "apply". I am not too
comfortable with the online do of apply.
> set.seed(122345671) > n<-3 > x<-rnorm(n); x
2024 Oct 04
1
apply
Even if this is not a homework question, it smells like one. If you read the Posting Guide it warns you that homework is off-topic, so when you impose an arbitrary constraint like "must use specific unrelated function" we feel like you are either cheating or wasting our time, and it is up to you to explain why we should follow you down this rabbit hole, keeping in mind that statistics
2006 Mar 11
2
Draw level lines on the surface of a bivariate function
Hello,
Is it possible to draw level lines on the surface of a bivariate function?
In the following example, to draw surface and levels lines for a
multivariate normal law,
I use persp, trans3d, contourLines and lines,
but if the lines are correctly drawn, some parts of them are, of
course, visible
even if they are drawn on a non visible "face".
Any suggestion to avoid this problem
2024 Oct 04
1
apply
Hello,
If you have a numeric matrix or data.frame, try something like
cov(mtcars)
Hope this helps,
Rui Barradas
?s 10:15 de 04/10/2024, Steven Yen escreveu:
> On 10/4/2024 5:13 PM, Steven Yen wrote:
>
>> Pardon me!!!
>>
>> What makes you think this is a homework question? You are not
>> obligated to respond if the question is not intelligent enough for you.