r code

1. Trying to write R function, binomial distribution

Hello! I am looking for some help with an Intro to R homework from a professor who doesn't clearly explain the things we need to know for the homework in class...:shakehead:confused: I'm trying to figure out how to write a function to simulate the sampling distribution of the mean when the...
2. Statistical Tools for Analysis of Effect of Light, Temp, CO2, and pH on Growth Rate

My question is, what may be the ideal tools to analyze the data from this experiment and what are some resources you can recommend to learn about them (textbooks, website, etc.). I'm also just starting to learn R so feel free to work that in there. I'm designing undergraduate research to be...
3. What wrong with my code?

I am running a DOE where i have generated a PB design. This ends up as a data table with my predictor variables and the experiments I need to run to generate my response variable. library(Rcmdr) library(RcmdrMisc) library(RcmdrPlugin.DoE) PB.DOE <- pb(nruns= 12 ,n12.taguchi= FALSE ,nfactors= 12...
4. Specifying the initial values of likfit function of geodata in R

I have a geostatistical data. For analysis, I am using geoR. I want to estimate the parameters. But likfit or variofit function requires initial values for the covariance parameters: \sigma^2 (partial sill) and \phi (range parameter). But I can't guess the initial values for my data...
5. R warning : the condition has length > 1 and only the first element will be used

I have data like following : year month day y 2007 7 1 3845 2007 7 2 3756 2007 7 3 3564 . . . 2007 7 31 3478 2007 8 1 3245 2007 8 2 3764 . . . 2007 8 31 3123 . . . 2008 12 31 3890...
6. R Coding Questions (Fitting log SLR onto normal scale)

Hey guys I'm having trouble with R and which codes to use(Newbie): So I have some data, I've performed a simple linear regression (SLR), however I found that this doesn't give me the relationship I want. So I performed another SLR analysis using the log (base 'e') of both the variables...
7. Generating peer nomination dataset in R

Hi all, I have been trying to generate a dataset on peer nominations in R. Often in research participants are asked to nominate others in the peer group (or classroom) as a friend. My requirements Each peer has to nominate x other peers as friends Participants can't select themselves...
8. How to compute mean of each variables of a list in R ?

The following is a function of simulating data from simple linear regression and calculating non-coverage probability of each parameters . simfun <- function(n,b0,b1,sig){ x <- runif(n) y <- b0+b1*x+ rnorm(n,0,sig) data <- data.frame(y=y,x=x) } noncoverage <-...
9. Specifying formula of lmer() function in R .

Am I specifying my lmer model correctly ? Say I have one independent variable (X) at individual level and one independent variable (Z) at group level. Both are continuous variable . If the model is...
10. How does "qpois(1-pvars, 3, .25) " work in R ?

R code : library(MASS) mu <- rep(0,4) Sigma <- matrix(.7, nrow=4, ncol=4) + diag(4)*.3 rawvars <- mvrnorm(n=10000, mu=mu, Sigma=Sigma) pvars <- pnorm(rawvars) binomvars <- qpois(1-pvars, 3, .25) I have not understood how does qpois(1-pvars, 3, .25) work ? What is the...
11. Help with glm--- Simple Logistic Regression

Hi All! Thanks for reading. I wanted to compare month of sample collection (April, May, June, and July) to presence/absence data (coded in binary dummy variables). I tried to run a Simple logistic regression, but realized that the output table with p values, etc all report for may, June, and...
12. Comparing count data and cultivars in R

Hi, I'm trying to analyse an experiment with this setup: A plant species with 16 different cultivars of 4-5 plants per cultivar (completely randomised within greenhouse, no blocks) An insect species that was allowed to spread freely for 4 days on the plants. The insect number per plant was...
13. Choice of test in R. Repeated measurements, binary response and missing data...

I have two treatments and one co-variate (affect the response variable but is also correlated with one of the treatments). Each replicate has been examined for the presence/absence of morphological characters at several time point but there are unfortunately a lot of missing data. What would be...
14. Making Seasonal Data form Monthly

I've got a climate data set spanning a number of years in monthly intervals, but I'm only interested in what happens in winter months - October through to March. I've narrowed my data set to only include these months, but now I need to group them into yearly winters eg. winter of 2006-2007...
15. about random walk Metropolis algorithm

Our model is: Y is distributed from a Negative binomial(r,p) where log(p/1-p)=xb. The prior of b is a multivariate normal(mu0, C0=Diag(k0,k1,...,km)) and prior of r is Geometric(q). We want to edit a R code of random walk Metropolis algorithm to obtain samples from the joint posterior...
16. Confusing Sampling Distribution Problem

Ok, I was understanding how to work sampling distribution problems until I came to this one, and I cannot figure out how to do it for the life of me: Let X be the lifetime of an electronic device. It is known that the average lifetime of the device is 717 days and the standard deviation is 90...
17. I need help on R basics; particularly list manipulation

First time poster - Thanks in advance for your help! I am reading in over a 1000 data input entries from a ".csv" file that look like the following list: can't drive after midnight and before 5am cannot drive from 12:30am-5am Be off the road by 12:30am I don't know 12:30 curfew curfew-12:30...