similar to: Simulating data, loop

Displaying 20 results from an estimated 2000 matches similar to: "Simulating data, loop"

2010 Dec 29
0
Simulating data and imputation
Hi, I wrote a script in order to simulate data, which I will use for evaluating missing data and imputation. However, I'm having trouble with the last part of my script, in which a dataframe is constructed without missing values. This is my script: y1 <- rnorm(10,0,3) y2 <- rnorm(10,3,3) y3 <- rnorm(10,3,3) y4 <- rnorm(10,6,3) y <- c(y1,y2,y3,y4) a1 <-rep(1,20) a2
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 <-
2007 Aug 19
1
Creating a data set within a function
Dear Friends, I'm trying to find if there is a way to automate creation of the design matrix. Suppose we are interested in say running an autoregressive model. The user inputs the following data myfunAR <- function(y, order) {..... ...... } now here y is the data series and order represents the level of the process. In other words if order=2 then we have an AR (2) process. Now it is easy
2005 Apr 04
1
custom loss function + nonlinear models
Hi all; I'm trying to fit a reparameterization of the assymptotic regression model as that shown in Ratkowsky (1990) page 96. Y~y1+(((y2-y1)*(1-((y2-y3)/(y3-y1))^(2*(X-x1)/(x2-x1))))/(1-((y2-y3)/(y3-y1))^2)) where y1,y2,y3 are expected-values for X=x1, X=x2, and X=average(x1,x2), respectively. I tried first with Statistica v7 by LS and Gauss-Newton algorithm without success (no
2006 Mar 16
1
lme4/Matrix: Call to .Call("mer_update_y"...) and LMEoptimize gives unexpected side effect...
Dear all I want to compute Monte Carlo p-values in lmer-models based on sampled data sets. To speed up calculations, I've tried to use internal functions from the Matrix package (as suggested ealier on the list by Doug Bates). So I did: fm2 <- lmer(resistance ~ ET + position + (1|Grp), Semiconductor,method='ML') simdata<-simulate(fm2,nsim=1) ynew <- simdata[,1] mer
2008 Apr 10
6
two graphs in one figure?
Dear all, how can I plot a line graph and a bar graph in one single figure? I tried to combine "barplot" and "plot". Even though they both have the same x-values (1 to 55),  it just doesnt look as if they match in their scale (the barplot is much wider than the "plot"....even though I tried to put limits on the x-axis). Here is an example of what I did:
2005 Feb 13
2
row equality.
I think that this is an easy one... I have a matrix where each row is an (x,y,z) triplet. Given a potential (xnew,ynew,znew) triplet I want to know if the matrix already contains a row with the new values (the space already has that point). I can do it using a for loop, but I would like to know if there is anyway in which I can do it without the for loop. I do it now like this (this
2011 Jun 14
2
Need script to create new waypoint
Dear help-list members, I am a student at Durham University (UK) conducting a PhD on spatial representation in baboons. Currently, I'm analysing the effect of sampling interval on home range calculations. I have followed the baboons for 234 days in the field, each day is represented by about 1000 waypoints (x,y coordinates) recorded at irregular time intervals. Consecutive waypoints in
2009 Feb 03
1
Collapsing panel data
Dear R-helpers, I've been thinking about this for some time, maybe someone can help. I have a fairly large dataset with thousands of firms, call the a, b, c, etc.. such as [,1] [,2] [1,] "A" 0.5 [2,] "" 0.2 [3,] "" 0.3 [4,] "B" 0.1 [5,] "" 0.9 [6,] "C" 0.4 Or to put it differently two vectors such as y
2005 Sep 06
2
Predicting responses using ace
Hello everybody, I'm a new user of R and I'm working right now with the ACE function from the acepack library. I Have a question: Is there a way to predict new responses using ACE? What I mean is doing something similar to the following code that uses PPR (Projection Pursuit Regression): library(MASS) x <- runif(20, 0, 1) xnew <- runif(2000, 0, 1) y <- sin(x) a <- ppr(x, y,
2012 Jul 02
0
Fit circle with R
Dear Researchers, I wrote two function to fit a circle using noisy data. 1- the fitCircle() is derived from MATLAB code of * zhak Bucher* from the link http://www.mathworks.com/matlabcentral/fileexchange/5557-circle-fit/content/circfit.m 2- the CircleFitByPratt() from MATLAB code of *Nikolai Chernov *from the link
2010 Oct 03
2
How to programme R to randomly replace some X values with Outliers
Dear experts, I am a beginner of R. I'm looking for experts to guide me how to do programming in R in order to randomly replace 5 observations in X explanatory variable with outliers drawn from U(15,20) in sample size n=100. The replacement subject to y < 15. The ultimate goal of my study is to compare the std of y with and without the presence of outliers based on average of 1000
2010 Oct 06
2
A problem --thank you
dear:teacher i have a problem which about the polr()(package "MASS"), if the response must have 3 or more levels? and how to fit the polr() to 2 levels? thank you. turly yours [[alternative HTML version deleted]]
2010 Oct 31
1
R-help Digest, Vol 92, Issue 31
Hi, I'd like to unsubscribe from the list. Thanks Neyra ________________________________ De: "r-help-request@r-project.org" <r-help-request@r-project.org> Para: r-help@r-project.org Enviado: sáb, octubre 30, 2010 5:30:07 AM Asunto: R-help Digest, Vol 92, Issue 31 Send R-help mailing list submissions to r-help@r-project.org To subscribe or unsubscribe via the
2008 Mar 22
1
Simulating Conditional Distributions
Dear R-Help List, I'm trying to simulate data from a conditional distribution, and haven't been able to modify my existing code to do so. I searched the archives, but didn't find any previous post that matched my question. n=10000 pop = data.frame(W1 = rbinom(n, 1, .2), W2 = runif(n, min = 3, max = 8), W3 = rnorm(n, mean=0, sd=2)) pop = transform(pop, A = rbinom(n, 1,
2005 Dec 29
2
How to fit all points into plot?
Hi, I have a problem when I want to add new points (or a new line) to the graph. Some points (or parts of the line) are not shown on the graph because they lie beyond the scale of the axis. Is there a way to overcome this so all points (or the entire line) are shown on the graph? Here's an example of my problem: colors = c("red", "blue") plot(x=rnorm(100,0,1),
2011 Jul 02
1
Simulating inhomogeneous Poisson process without loop
Dear all I want to simulate a stochastic jump variance process where N is Bernoulli with intensity lambda0 + lambda1*Vt. lambda0 is constant and lambda1 can be interpreted as a regression coefficient on the current variance level Vt. J is a scaling factor How can I rewrite this avoiding the loop structure which is very time-consuming for long simulations? for (i in 1:N){ ... N <- rbinom(n=1,
2005 Aug 08
1
bug found in predict.locfit in locfit package (PR#8057)
Full_Name: Somkiat Apipattanavis Version: 2.1.1 OS: Windows Submission from: (NULL) (128.138.44.123) Bug found in predict.locfit for density estimation # Example of bug found in prdict.locfit (Locfit) library('locfit') # generate data y =c(4281,2497,4346,5588,5593,3474,4291,2542,5195,4056, 3114,2864,4904,7625,3377,4001,4999,7191,8062,5668) x1=c( 0.258729, 1.460156, 0.192323,
2008 Dec 19
0
How to plot arrows for a PLS plot with ggplot2?
Dear community, I'd like to build a PLS plot with scores and loadings, sometimes called "biplot". Like in biplot.mvr {pls} but using ggplot2. 1. Scores plot. No problem! ggplot(data=data1,aes(x=plsr1,y=plsr2))+geom_point(aes(colour=solenergy,shape=type))+geom_text(aes(label=res,size=1,hjust=0,vjust=0)) where, > str(data1) 'data.frame': 295 obs. of 5 variables: $
2005 Oct 05
0
bug found in predict.locfit in locfit package ( PR#8057)
Apologies for the coming to this late... 1. By now I hope Somkiat has realized that R-bugs is not the place to report problems in contributed packages. Please direct such reports to the package maintainer. 2. This is really user error. predict() expect the newdata to be a data frame containing variables with the same names as those used in the fitting process. E.g., you fitted the model with