similar to: using sample

Displaying 20 results from an estimated 6000 matches similar to: "using sample"

2012 Nov 10
3
sample mean, variance and SD
hi could you help me to solve this issue Question: Using command rweibull(100,8,15), simulate n = 100 realizations from Weibull(8; 15) distribution. Using the simulated sample, compute the sample mean, variance and standard deviation of these observations. I am trying like this sim<-rweibull(100,8,15) # simulated sample SM<-mean(sim) # simulated sample mean var(sim) # variance
2011 Aug 05
3
excel dates and times in R
Hello, I am having some fun dealing with dates and times. My input is a excel csv file with two columns with data in the following format: date time 25-Jun-1961 04:00:00 i.e. day - month - year hour:min:sec I would like to have a single object in R that combines these and converts them into a sensible R format (e.g.
2004 Aug 25
1
brlr function
Hi, I'm trying the brlr function in a penalized logistic regression function. However, I am not sure why I am encountering errors. I hope to seek your advice here. (output below) Thank you! Your help is truly appreciated. Min-Han #No error here, the glm seems to work fine >
2008 Jul 14
2
Backslash in sub pattern?
Dear guRus, I am trying to replace "~" by "$\sim$" for TeX. However, I can't get the backslash to work. I would like to turn "DV~IV" into "DV$\sim$IV". sub("~","$\sim$","DV~IV") => "DV$sim$IV" sub("~","$\\sim$","DV~IV") => "DV$sim$IV"
2013 Mar 08
4
Substitute value
Hi, I have a large data frame and within this there is one column which contains individual codes (eg. 1.1234.2a.2). I am splitting these codes into their 4 components using strsplit (eg. "1", "1234", "2a", "2"). However there are some individual codes which do not have a last component (eg. 2.4356.3b. ), I want to give these codes a "1" as their
2010 Oct 20
3
Plot help
Dear List, I am relatively new to R and am trying to create more attractive plots than excel can manage! I have looked through the various programmes ggplot, lattice, hmisc etc but my case seems to be not metnioned, maybe it is but i have not noticed - if this is the case i apologise.
2019 May 15
1
domain still running although snapshot-file is deleted !?!
Hi, i have a strange situation: A domain is still running where domblklist points to a snapshot file and also dumpxml says the current drive is that snapshot file. But the file has been deleted hours ago. And the domain is still running. I can login via ssh, the database and the webserver are still running, domain is performant. How can that be ? Also lsof shows that the file is deleted:
2005 Apr 13
1
i param in "for" loop does not takes zeros?
Hi all Is there any reason why the parameter i in a "for" loop ignores a value of zero? For example sim=c() p=.2 for(i in 0:5) {sim[i]=dbinom(i,5,p) } sim [1] 0.40960 0.20480 0.05120 0.00640 0.00032 In this example the quantile i= 0 was ignored since dbinom(0,5,p) [1] 0.32768 The same behaviour occurs if I use a while loop to perform the same calculation: sim=c() p=.2 i=0
2006 Jan 13
1
Variance-covariance by factor
Dear all, I have a data frame with one factor and four numeric variables and wish to obtain the var-cor matrix separately by factor. I tried by() and sapply() but getting nowhere. I understand this can be done by subsetting the dataframe, but there should have some sleek ways of doing it. Here is a simulated dataframe; s <- rep(c("A","B","C"), c(25,22,18)) d
2006 Oct 08
1
Simulate p-value in lme4
Dear r-helpers, Spencer Graves and Manual Morales proposed the following methods to simulate p-values in lme4: ************preliminary************ require(lme4) require(MASS) summary(glm(y ~ lbase*trt + lage + V4, family = poisson, data = epil), cor = FALSE) epil2 <- epil[epil$period == 1, ] epil2["period"] <- rep(0, 59); epil2["y"] <- epil2["base"]
2006 Feb 27
1
Different deviance residuals in a (similar?!?) glm example
Dear R-users, I would like to show you a simple example that gives an overview of one of my current issue. Although my working setting implies a different parametric model (which cannot be framed in the glm), I guess that what I'll get from the following example it would help for the next steps. Anyway here it is. Firstly I simulated from a series of exposures, a series of deaths (given a
2004 May 24
1
Null model for arima.sim().
In some time series simulations I'm doing, I occasionally want the model to be ``white noise'', i.e. no model at all. I thought it would be nice if I could fit this into the arima.sim() context, without making an exceptional case. I.e. one ***could*** do something to the effect if(length(model)==0) x <- rnorm(n) else x <- arima.sim(model,n) but it would be more suave if one
2005 May 26
1
PAN: Need Help for Multiple Imputation Package
Hello all. I am trying to run PAN, multilevel multiple imputation program, in R to impute missing data in a longitudinal dataset. I could successfully run the multiple imputation when I only imputed one variable. However, when I tried to impute a time-varying covariate as well as a response variable, I received an error message, “Error: subscript out of bounds.” Can anyone tell if my commands
2008 Jul 09
4
Strptime/ date time classes
Dear all, I've come across a problem using strptime, can anyone explain what's going on? I'm using version 2.7.0 on Windows XP. Thank you Caroline First read in a data file using read.table alldata = read.table(file, header=F, skip=4, colClasses = c("character","numeric")) dim(alldata) [1] 223960 2 # inefficient, safe way of sorting out missing or dodgy
2008 Aug 01
5
drop1() seems to give unexpected results compare to anova()
Dear all, I have been trying to investigate the behaviour of different weights in weighted regression for a dataset with lots of missing data. As a start I simulated some data using the following: library(MASS) N <- 200 sigma <- matrix(c(1, .5, .5, 1), nrow = 2) sim.set <- as.data.frame(mvrnorm(N, c(0, 0), sigma)) colnames(sim.set) <- c('x1', 'x2') # x1 & x2 are
2005 Oct 10
1
using innov in arima.sim
Hello, I have used the arima.sim function to generate a lot of time series, but to day I got som results that I didn't quite understand. Generating two time series z0 and z1 as eps <- rnorm(n, sd=0.03) z0 <- arima.sim(list(ar=c(0.9)), n=n, innov=eps) and z1 <- arima.sim(list(ar=c(0.9)), n=n, sd=0.03), I would expect z0 and z1 to be qualitatively similar. However, with n=10 the
2006 Sep 20
4
Calculating mean together with split
Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 1 6 lng_cs99_renosterbos 1 4 0.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each
2008 Mar 15
2
Please find the error in my code
hello everybody I use the following code for my programming & it runs with the error as specified below.Any help that would disolve the error will be highly appreciated. Thanks in advance my code looks like this #### R programme for simulating the power of the two sample t test vs various #### non-parametric alternatives sim.size <- 200 sample.size <- 10 set.seed(231) mu1 <- 0 delta
2008 Mar 05
2
simulating the anova
I have been trying to figure out how to run a simple simulation of the ANOVA and I'm coming up just a bit short. The code I've got is: cohen.f = .25 groups = 4 between.var = 19 within.var = between.var / cohen.f ^ 2 n = 500 sim.means = rnorm(n = groups, mean = 0, sd = sqrt(between.var)) sim.data = lapply(sim.means, function(mean) rnorm(n = n, mean = mean, sd = sqrt(within.var)))
2011 May 11
1
Adding reference line or plane to cloud or wireframe
All, I am wondering how one might add a reference line or plane to a cloud or wireframe plot. I have been unable to figure this out. Let's say I would like to draw a reference for some value of wt in the example below: cl <- 54.1 age <- 10:80 wt <- 25:160 sim <- expand.grid(age = age,wt = wt) sim$cl <- cl*(sim$wt/70)**0.412 * (sim$age/50)**0.152