Displaying 20 results from an estimated 110 matches similar to: "Two 3D cones in one graph"
2011 Feb 07
1
multiple imputation manually
Hi,
I want to impute the missing values in my data set multiple times, and then
combine the results (like multiple imputation, but manually) to get a mean
of the parameter(s) from the multiple imputations. Does anyone know how to
do this?
I have the following script:
y1 <- rnorm(20,0,3)
y2 <- rnorm(20,3,3)
y3 <- rnorm(20,3,3)
y4 <- rnorm(20,6,3)
y <- c(y1,y2,y3,y4)
x1 <-
2012 Sep 17
2
Problem with Stationary Bootstrap
Dear R experts,
I'm running the following stationary bootstrap programming to find the parameters estimate of a linear model:
X<-runif(10,0,10)
Y<-2+3*X
a<-data.frame(X,Y)
coef<-function(fit){
fit <- lm(Y~X,data=a)
return(coef(fit))
}
result<- tsboot(a,statistic=coef(fit),R = 10,n.sim = NROW(a),sim = "geom",orig.t = TRUE)
Unfortunately, I got this
2007 Oct 31
1
Simple Umacs example help..
Hello all...
I am just starting to teach myself Bayesian methods, and am
interested in learning how to use UMacs. I've read the
documentation, but the single example is a bit over my head at the
level I am at right now. I was wondering if anyone has any simple
examples they'd like to share. I've successfully done a couple of
simple gibbs examples, but have had a hard time
2011 Sep 19
0
nls picewise FvCB model
Greetings R users, maybe there is someone who can help me with this problem:
I'm trying to fit this discontinous model :
GE<-data.frame( Ci<-c(81,87,91,111,159,173,295,453,629,984),
A<-c(-0.9,1.2,3.5,8.3,13.1,14.4,22.9,27.3,29.6,32.6) )
rhs <- function(Ci, Vcmax, J, Rd) {
? ?R <-0.008314472
? ?Tleaf <-25
? ?Kc <-exp(38.05-79.43/(R*(Tleaf+273.15)))
? ?Ko
2003 May 09
1
manipulating elements of a matrix
Dear R users:
I have the following matrix.
0 1 1
0 1 0
2 1 0
3 0 0
I would like to spread the matrix such that whenever the row sum is greater
than 1 the row is repeated the number of times given by the row sum.
Furthermore I would like to split the following cases:
0 1 1
such that it map to the following matrix
0 1 0
0 0 1
such that each row adds up to 1.
I have no problems with cases
2009 Jul 17
6
Solving two nonlinear equations with two knowns
Dear R users,
I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal solution changes when I change initial values. How to solve this?
BTW, I also try to use grid searching. But I have no information on ranges of x1 and x2, respectively.
Any suggestion to solve this question?
Thanks,
Kate
2017 Oct 17
4
uniform sampling without replacement algorithm
Let us consider the current uniform sampling without replacement
algorithm. It resides in function do_sample in
https://svn.r-project.org/R/trunk/src/main/random.c
Its complexity is obviously O(n), where the sample is selected from
1...n, since the algorithm has to create a vector of length n. So when
the sample size is much lesser than n, the algorithm is not effective.
Algorithms with
2011 Jun 29
1
Numerical integration
Hello!
I know that probably my question is rather simple but I' m a very beginner
R-user.
I have to numerically integrate the product of two function A(x) and B(x).
The integretion limits are [X*; +inf]
Function A(x) is a pdf function while B(x)=e*x is a linear function whose
value is equal to 0 when the x < X*
Moreover I have to iterate this process for different value of X* and for
2009 Sep 17
2
R functions with array arguments
Dear R users,
I'm trying to implement a self-defined function with multiple
arguments, one of which is an array, but I find that the result is a
single value instead of an array.
This is the example I'm working on:
# define integration limit vector
> Mabslim <- c(-17.95, -16.65, -17.27, -17.62, -16.76, -17.07, -17.02)
# Define function
> schech<-function(x,alpha,xstar)
2013 Apr 30
1
Question regarding error "x and y lengths differ"
Hello, I'm a first semester statistics
student<http://r.789695.n4.nabble.com/Question-regarding-error-quot-x-and-y-lengths-differ-quot-td4665773.html#>and
I am using R for roughly the third time ever. I am following a
tutorial
and yet I still get the error "x and y lengths differ." I am very new to
this program, and I have searched for solutions, but because I do not
understand
2013 Apr 03
1
prop.test vs hand calculated confidence interval
Hi,
This code:
n=40
x=17
phat=x/n
SE=sqrt(phat*(1-phat)/n)
zstar=qnorm(0.995)
E=zstar*SE
phat+c(-E,E)
Gives this result:
[1] 0.2236668 0.6263332
The TI Graphing calculator gives the same result.
Whereas this test:
prop.test(x,n,conf.level=0.99,correct=FALSE)
Give this result:
0.2489036 0.6224374
I'm wondering why there is a difference.
D.
--
View this message in context:
2001 Aug 30
1
MCMC coding problem
Dear All,
I am trying to convert some S-plus code that I have to run MCMC into
R-code. The program works in S-plus, but runs slowly.
I have managed to source the program into R. R recognizes that the program
is there; for example, it will display the code when I type the function
name at the prompt. However, the program will not run. When I try to run
the program, I get the following error
2006 Jan 19
2
Tobit estimation?
Folks,
Based on
http://www.biostat.wustl.edu/archives/html/s-news/1999-06/msg00125.html
I thought I should experiment with using survreg() to estimate tobit
models.
I start by simulating a data frame with 100 observations from a tobit model
> x1 <- runif(100)
> x2 <- runif(100)*3
> ystar <- 2 + 3*x1 - 4*x2 + rnorm(100)*2
> y <- ystar
> censored <- ystar <= 0
2012 Oct 25
2
How to extract auc, specificity and sensitivity
I am running my code in a loop and it does not work but when I run it
outside the loop I get the values I want.
n <- 1000; # Sample size
fitglm <- function(sigma,tau){
x <- rnorm(n,0,sigma)
intercept <- 0
beta <- 0
ystar <- intercept+beta*x
z <- rbinom(n,1,plogis(ystar))
xerr <- x + rnorm(n,0,tau)
model<-glm(z ~ xerr, family=binomial(logit))
2012 Oct 20
1
Logistic regression/Cut point? predict ??
I am new to R and I am trying to do a monte carlo simulation where I
generate data and interject error then test various cut points; however, my
output was garbage (at x equal zero, I did not get .50)
I am basically testing the performance of classifiers.
Here is the code:
n <- 1000; # Sample size
fitglm <- function(sigma,tau){
x <- rnorm(n,0,sigma)
intercept <- 0
beta
2008 Sep 15
0
Simple censored quantile regression question
I start by doing a simple gaussian tobit by MLE:
x1 <- runif(1000) # E() = 0.5
x2 <- runif(1000)*2 # E() = 1
x3 <- runif(1000)*4 # E() = 2
ystar <- -7 + 4*x1 + 5*x2 + rnorm(1000) # is mean 0
y <- ystar
censored <- ystar <= 0
y[censored] <- 0
library(AER)
m <- tobit(y ~ x1 + x2, left=0, data=D)
summary(m)
Which gives:
Call:
2002 Feb 11
0
profile
I am running 1.3.1 on a Windows (NT 4.0) machine. I've fit a nonlinear
model intended to predict crop yield from nutrient information, and want to
use the profile function. If I type say,
profile(simparj.fm)
I get the following error message:
"Error in prof$getProfile(): number of iterations exceeded maximum of
5.25515e-308"
I used the profiler function to profile simparj,fm step
2008 Dec 16
1
Prediction intervals for zero inflated Poisson regression
Dear all,
I'm using zeroinfl() from the pscl-package for zero inflated Poisson
regression. I would like to calculate (aproximate) prediction intervals
for the fitted values. The package itself does not provide them. Can
this be calculated analyticaly? Or do I have to use bootstrap?
What I tried until now is to use bootstrap to estimate these intervals.
Any comments on the code are welcome.
2012 Oct 26
0
Problems getting slope and intercept to change when do multiple reps.
library(ROCR)
n <- 1000
fitglm <- function(iteration,intercept,sigma,tau,beta){
x <- rnorm(n,0,sigma)
ystar <- intercept+beta*x
z <- rbinom(n,1,plogis(ystar))
xerr <- x + rnorm(n,0,tau)
model<-glm(z ~ xerr, family=binomial(logit))
*int*<-coef(model)[1]
*slope*<-coef(model)[2] # when add error you are suppose to get slightly
bias slope. However when I change
2009 Jul 09
0
Programming using formulas
Dear R experts,
I'm planning to write some kind of multivariate regression function
where I would like to use a formula method.
My question is if there is anywhere some detailed introduction how to
program formulas in R?
A bit more about what I need:
I would like to start implementing a multivariate hierarchical
regression model and to keep it simple in the beginning I would restrict