Dear R-useRs,
I'm looking for an R-function for censored linear regression. I have the
following data
x1 - rnorm(100)
x2 - rnorm(100)
y - x1 + 2*x2 + rnorm(100,0,0.5)
stat - rep(1,100)
stat[50:100] - 0
data - data.frame(y,x1,x2,stat)
y is the dependent variable, x1 and x2 are the independent
Dear R users,
i try to calculate the probabilty to survive a given time by using the
estimated survival curve by kaplan meier.
What is the right way to do that? as far as is see i cannot use the
predict-methods from the survival package?
library(survival)
set.seed(1)
time -
Dear R-users,
i try to use the following code to do a gamma regression
glm(x1 / x2 ~ x3 + x4 + x5 + x6 + x7 + x8, family=Gamma(link=log),
weights=x2)
but here i get the error
Error: NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
step size truncated due to
Dear R-users,
after trying and searching a long time i have the following question.
is it possible to replace to following double loop by some apply calls?
###
m1 - data.frame(v1=factor(letters[1:5]),
)
On Fri, May 14, 2010 at 9:23 AM, Andreas Wittmann
andreas_wittm...@gmx.de mailto:andreas_wittm...@gmx.de wrote:
Dear R-users,
after trying and searching a long time i have the following question.
is it possible to replace to following double loop by some apply
calls
Dear R-users,
i have the following exmple for which i want to use ecm.mix from the
mix-package.
with da.mix after using em.mix i get the error improper
posterior--empty cells, which is not uncommen because of 17 * 5 * 3 =
255 cells.
so the next attempt is to use the ecm.mix for the
Hi R-useRs,
after having read
http://tolstoy.newcastle.edu.au/R/help/05/07/8498.html
with the same topic but five years older. the solution for a contr.sum
with names for factor levels for R version 2.10.1 will be to comment out
the following line
#colnames(cont) - NULL
in contr.sum i
Dear R-users,
i have a simple problem maybe, but i don't see the solution. i want to
find the entry-wise closest element of an vector compared with another.
ind1-c(1,4,10)
ind2-c(3,5,11)
for (i in length(ind2):1)
{
print(which.min(abs(ind1-ind2[i])))
}
for ind2[3] it should be ind1[3] 10,
On Jan 17, 2010, at 11:00 AM, Andreas Wittmann wrote:
Dear R-users,
i have a simple problem maybe, but i don't see the solution. i want
to find the entry-wise closest element of an vector compared with
another.
ind1-c(1,4,10)
ind2-c(3,5,11)
for (i in length(ind2):1)
{
print(which.min
Dear R-users,
actually i try to parse some state protocols for my work. i an easy
stetting the code below works fine, if states are reached only once. in
harder settings it could be possible that one state gets visited more
times. in this case for me its interesting to see how much waiting
Dear R-users,
after several tries with lapply and searching the mailing list, i want
to ask, wheter and how it is possibly to avoid the for-loop in the
following piece of code?
set2-as.data.frame(matrix(rnorm(9),ncol=3))
set2[1,1] - NA
set2[3,2] - NA
set2[2,1] - NA
dimnames(set2)[1] -
,
baptiste
2009/12/10 Andreas Wittmann andreas_wittm...@gmx.de:
Dear R-users,
after several tries with lapply and searching the mailing list, i want to
ask, wheter and how it is possibly to avoid the for-loop in the following
piece of code?
set2-as.data.frame(matrix(rnorm(9),ncol=3))
set2[1,1
Dear R-users,
i try to solve to following linear programm in R
0 * x_1 + 2/3 * x_2 + 1/3 * x_3 + 1/3 * x_4 = 0.3
x_1 + x_2 + x_3 + x_4 = 1
x_1, x_2, x_3, x_4 0,
x_1, x_2, x_3, x_4 1
as you can see i have no objective function here besides that i use the
following code.
library(lpSolve)
Dear R-users,
i try to generate missing values in a matrix X according to a given
missingnes pattern R with the probabilities p per row.
X-matrix(rnorm(3*100),ncol=3)
## indicator matrix for missingnes (1 observed, 0 missing)
R-matrix(c(1,1,1,
0,0,1,
1,1,0,
))
}
predict.drop(x ~ ., training, test)
best regards
Andreas
David Winsemius wrote:
On Nov 25, 2009, at 1:48 AM, Andreas Wittmann wrote:
Sorry for my bad description, i don't want get a constructed
algorithm without own work. i only hoped to get some advice how to do
this. i don't want
Dear R-users,
in the follwing thread
http://tolstoy.newcastle.edu.au/R/help/03b/3322.html
the problem how to remove rows for predict that contain levels which are
not in the model.
now i try to do this the other way round and want to remove columns
(variables) in the model which will be
this problem is quite common and i can use an algorithm somebody has
already implemented.
best regards
Andreas
Original-Nachricht
Datum: Wed, 25 Nov 2009 00:48:59 -0500
Von: David Winsemius dwinsem...@comcast.net
An: Andreas Wittmann andreas_wittm...@gmx.de
CC: r-help@r
Dear R-users,
i try to recode a factor according to old levels
F - factor(sample(c(rep(A, 4), rep(B,2), rep(C,5
recode(F, levels(F)[c(1,3)]='X'; else='Y')
i tried to work with eval or expression around levels(F)[c(1,3)], but
nothing seems to work.
Many thanks if anyone could tell me
Dear R-Users,
i want to use the function svm of the e1071 package to predict missing data
data(iris)
## create missing completely at random data
for (i in 1:5)
{
mcar - rbinom(dim(iris)[1], size=1, prob=0.1)
iris[mcar == 1, i] -
Dear R-Users,
i want to use the function mice of the mice package with data, that
contains dates, but this gives an error
x - Sys.time()
dat - data.frame(dates=(1:10)*60*60*24+x, size=rnorm(10))
dat$dates[c(3,7)]-NA
mice(dat)
Fehler in check.imputationMethod(imputationMethod,
Dear R-users,
i try to fit a multinomial model in order to get an imputation for a
missing value in factor1.
library(nnet)
factor1 - factor(c(a,b,c,d))
factor2 - factor(c(e,f,g,h))
size - c(3,8,2,1)
factor1[3] - NA
Z-ifelse(is.na(factor1), 0, 1)
assign(data,
Dear R-users,
i have to integrate the following function
`fun1` - function (a, l1, l2)
{
exp(log(l1) * (a - 1) - l2 * lgamma(a))
}
but if l1 is large, i get the non-finite function value error, so my
idea is to rescale with exp(-l1)
`fun2` - function (a, l1, l2)
{
exp(log(l1) * (a - 1) -
Dear R users,
i try to integrate lgamma from 0 to Inf. But here i get the message roundoff
error is detected in the extrapolation table, if i use 1.0e120 instead of Inf
the computation works, but this is against the suggestion of integrates help
information to use Inf explicitly. Using
Dear R useRs,
after searching r-help and r-manuals for about one hour i have the
following, probably easy question for you.
i have the following R-code, in the file test01.R
`fun1` - function(x)
{
x - x + 2
Dear R useRs,
i have the function f1(x, y, z) which i want to integrate for x and y.
On the one hand i do this by first integrating for x and then for y, on
the other hand i do this the other way round and i wondering why i
doesn't get the same result each way?
z - c(80, 20, 40, 30)
f1 -
, Andreas Wittmann wrote:
Dear R useRs,
i have the function f1(x, y, z) which i want to integrate for x and
y. On the one hand i do this by first integrating for x and then for
y, on the other hand i do this the other way round and i wondering
why i doesn't get the same result each way?
z - c(80
Dear R users,
i would like to transform the following function from R-code to C-code and call
it from R in order to speed up the computation because in my other functions
this function is called many times.
`dgcpois` - function(z, lambda1, lambda2)
{
`f1` - function(alpha, lambda1, lambda2)
Dear R useRs,
with the following piece of code i try to find the first value which can
be calculated without warnings
`test` - function(a)
{
repeat
{
## hide warnings
suppressWarnings(log(a))
if (exists(last.warning, envir = .GlobalEnv))
{
a - a + 0.1
## clear
Dear R useRs,
yesterday i updated my system from ubuntu 8.04 to 8.10. I use emacs-
snapshot, this is emacs 23.0.60.1 and ess 5.3.8. Before the update i
had when starting emacs with an R file an ess-toolbar with little
icons to start R or to evaluate a line or a region of my R file, but
no this
Dear R useRs,
i wanted to ask if the folded normal destribution (Y = abs(X) with X
normal distributed)
with density and random number generator is implemented in R or in any
R-related package
so far? Maybe i can use the non-central chi-square distribution and
rchisq(n, df=1, ncp0) here?
the
compilation, if i delete it and try the compilation under ubuntu
everything works fine, don't know why?
best regards
Andreas
Dirk Eddelbuettel wrote:
On Sun, Oct 19, 2008 at 01:27:06AM +0200, Andreas Wittmann wrote:
Dear R useRs,
on ubuntu 8.04 i try to create a shared object out
Dear R useRs,
on ubuntu 8.04 i try to create a shared object out of a c-file
this is
// add.c
#include Rinternals.h
SEXP addiere(SEXP a, SEXP b)
{
int i, n;
n = length(a);
for (i = 0; i n; i++)
REAL(a)[i] += REAL(b)[i];
return(a);
}
in terminal i type
R CMD SHLIB add.c
and get
gcc
Dear R useRs,
i try to compute the posterior mean for the parameters omega and beta
for the following
posterior density. I have simulated data where i know that the true
values of omega=12
and beta=0.01. With the function postMeanOmega and postMeanBeta i wanted
to compute
the mean values of
Thank you very much, yes maybe its worth working on it.
best regards
Andreas
Uwe Ligges wrote:
Andreas Wittmann wrote:
Dear R useRs,
i have the following code to compute values needed for a contour plot
myContour - function
Dear R useRs,
i try to integrate the following function for many values
integrand - function(z)
{
return(z * z)
}
i do this with a for-loop
for(i in 2:4)
{
z - integrate(integrand, i-1, i)$value
cat(z, z, \n)
}
to speed up the computation for many values i tried vectors
in integrate to do
(integrate, lower=vec1, upper=vec2, MoreArgs=list(f=integrand) )
baptiste
On 20 Sep 2008, at 13:08, Andreas Wittmann wrote:
Dear R useRs,
i try to integrate the following function for many values
integrand - function(z)
{
return(z * z)
}
i do this with a for-loop
for(i in 2:4)
{
z - integrate
Hello everybody,
i have the following problem to write a function which recognizes depending
on the parameter-inputs how many equations for the calculation in the function
are needed.
Here is an example of my problem:
myfun - function(a, b, c, d)
{
k - length(a)
#here d = 3 for
37 matches
Mail list logo