similar to: Put a normal curve on plot

Displaying 20 results from an estimated 5000 matches similar to: "Put a normal curve on plot"

2006 Sep 18
1
non linear modelling with nls: starting values
Hi, I'm trying to fit the following model to data using 'nls': y = alpha_1 * beta_1 * exp(-beta_1 * x) + alpha_2 * beta_2 * exp(-beta_2 * x) and the call I've been using is: nls(y ~ alpha_1 * beta_1 * exp(-beta_1 * x) + alpha_2 * beta_2 * exp(-beta_2 * x), start=list(alpha_1=4, alpha_2=2, beta_1=3.5, beta_2=2.5), trace=TRUE, control=nls.control(maxiter =
2005 Jan 06
2
Generating Data mvrnorm and loops
Dear List: I am generating N datasets using the following Sigma<-matrix(c(400,80,80,80,80,400,80,80,80,80,400,80,80,80,80,400),4,4 ) mu<-c(100,150,200,250) N=100 for(i in 1:N) { assign(paste("Data.", i, sep=''), as.data.frame(cbind(seq(1:1000),(mvrnorm(n=1000, mu, Sigma))))) } With these datasets, I need to work on some of the variables and then run each dataset
2011 Aug 19
3
Calculating p-value for 1-tailed test in a linear model
Hello, I'm having trouble figuring out how to calculate a p-value for a 1-tailed test of beta_1 in a linear model fit using command lm. My model has only 1 continuous, predictor variable. I want to test the null hypothesis beta_1 is >= 0. I can calculate the p-value for a 2-tailed test using the code "2*pt(-abs(t-value), df=degrees.freedom)", where t-value and degrees.freedom
2009 Jun 16
1
turning off escape sequences for a string
Hello, I would like to create a matrix with one of the columns named $\delta$. I have also created columns $\beta_1$ , $\beta_2$, etc. However, it seems like \d is an escape sequence which gets automatically removed. (Using these names such that they work right in xtable -> latex) colnames(simpleReg.mat) <- c("$\beta_1$","$SE(\beta_1)$", "$\beta_2$",
2011 Nov 23
2
lines and points in xyplot()
Given the following data, I want a scatterplot with the data points and the predictions from the regression. Sigma <- matrix(c(1,.6,1,.6), 2) mu <- c(0,0) dat <- mvrnorm(5000, mu, Sigma) x <- dat[,1] * 50 + 200 y <- dat[,2] * 50 + 200 fm <- lm(y ~ x) ### This gives the regression line, but not the data xyplot(y ~ x, type = c('g', 'p'),
2005 Jan 18
4
Data Simulation in R
Dear List: A few weeks ago I posted some questions regarding data simulation and received some very helpful comments, thank you. I have modified my code accordingly and have made some progress. However, I now am facing a new challenge along similar lines. I am attempting to simulate 250 datasets and then run the data through a linear model. I use rm() and gc() as I move along to clean up the
2005 Dec 01
2
Minimizing a Function with three Parameters
Hi, I'm trying to get maximum likelihood estimates of \alpha, \beta_0 and \beta_1, this can be achieved by solving the following three equations: n / \alpha + \sum\limits_{i=1}^{n} ln(\psihat(i)) - \sum\limits_{i=1}^{n} ( ln(x_i + \psihat(i)) ) = 0 \alpha \sum\limits_{i=1}^{n} 1/(psihat(i)) - (\alpha+1) \sum\limits_{i=1}^{n} ( 1 / (x_i + \psihat(i)) ) = 0 \alpha \sum\limits_{i=1}^{n} (
2005 Nov 24
1
residuals in logistic regression model
In the logistic regression model, there is no residual log (pi/(1-pi)) = beta_0 + beta_1*X_1 + ..... But glm model will return residuals What is that? How to understand this? Can we put some residual in the logistic regression model by replacing pi with pi' (the estimated pi)? log (pi'/(1-pi')) = beta_0 + beta_1*X_1 + .....+ ei Thanks! [[alternative HTML version deleted]]
2007 Sep 13
1
Problem using xtable on an array
Hi all I know about producing a minimal example to show my problem. But I'm having trouble producing a minimal example that displays this behaviour, so please bear with me to begin with. Observe: I create an array called model.mat. Some details on this: > str(model.mat) num [1:18, 1:4] -0.170 -0.304 -2.617 2.025 -1.610 ... - attr(*, "dimnames")=List of 2 ..$ : chr
2005 Dec 01
1
Simulate Correlated data from complex sample
Dear List: I have created some code to simulate data from a complex sample where 5000 students are nested in 50 schools. My code returns a dataframe with a variable representing student achievement at a single time point. My actual code for creating this is below. What I would like to do is generate a second column of data that is correlated with the first at .8 and has the same means within
2008 May 16
1
SE of difference in fitted probabilities from logistic model.
I am fitting a logistic binomial model of the form glm(y ~ a*x,family=binomial) where a is a factor (with 5 levels) and x is a continuous predictor. To assess how much ``impact'' x has, I want to compare the fitted success probability when x = its maximum value with the fitted probability when x = its mean value. (The mean and the max are to be taken by level of the factor
2008 Dec 08
1
Multivariate kernel density estimation
I would like to estimate a 95% highest density area for a multivariate parameter space (In the context of anova). Unfortunately I have only experience with univariate kernel density estimation, which is remarkebly easier :) Using Gibbs, i have sampled from a posterior distirbution of an Anova model with k means (mu) and 1 common residual variance (s2). The means are independent of eachother, but
2005 Jan 08
2
Does R accumulate memory
Dear List: I am running into a memory issue that I haven't noticed before. I am running a simulation with all of the code used below. I have increased my memory to 712mb and have a total of 1 gb on my machine. What appears to be happening is I run a simulation where I create 1,000 datasets with a sample size of 100. I then run each dataset through a gls and obtain some estimates. This works
2013 Oct 19
2
ivreg with fixed effect in R?
I want to estimate the following fixed effect model: y_i,t = alpha_i + beta_1 x1_t + beta_2 x2_i,tx2_i,t = gamma_i + gamma_1 x1_t + gamma_2 Z1_i + gamma_3 Z2_i I can use ivreg from AER to do the iv regression. fm <- ivreg(y_i,t ~ x1_t + x2_i,t | x1_t + Z1_i + Z2_i, data = DataSet) But, I'm not sure how can I add the fixed effects. Thanks! [[alternative HTML
2005 Jan 20
1
Windows Front end-crash error
Dear List: First, many thanks to those who offered assistance while I constructed code for the simulation. I think I now have code that resolves most of the issues I encountered with memory. While the code works perfectly for smallish datasets with small sample sizes, it arouses a windows-based error with samples of 5,000 and 250 datasets. The error is a dialogue box with the following: "R
2005 Jan 19
2
Referencing objects within a loop
Dear List: It appears that simulating data where all dataframes are stored as a list will only work for relatively small analyses. Instead, it appears that creating N individual dataframes, saving them, and loading them when needed is the best way to save memory and make this a feasible task. As such, I now have a new(er) question with respect to dealing with individual files within a loop. To
2018 Feb 16
2
[FORGED] Re: SE for all levels (including reference) of a factor atfer a GLM
On 16/02/18 15:28, Bert Gunter wrote: > This is really a statistical issue. What do you think the Intercept term > represents? See ?contrasts. > > Cheers, > Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom
2011 May 01
1
Simulation Questions
I have the following script for generating a dataset. It works like a champ except for a couple of things. 1. I need the variables "itbs" and "map" to be negatively correlated with the binomial variable "lunch" (around -0.21 and -0.24, respectively). The binomial variable "lunch" needs to remain unchanged. 2. While my generated variables do come out
2007 Feb 27
1
interactions and GAM
Dear R-users, I have 1 remark and 1 question on the inclusion of interactions in the gam function from the gam package. I need to fit quantitative predictors in interactions with factors. You can see an example of what I need in fig 9.13 p265 from Hastie and Tibshirani book (1990). It's clearly stated that in ?gam "Interactions with nonparametric smooth terms are not fully
2018 Feb 16
0
[FORGED] Re: SE for all levels (including reference) of a factor atfer a GLM
To give a short answer to the original question: > On 16 Feb 2018, at 05:02 , Rolf Turner <r.turner at auckland.ac.nz> wrote: > > In order to ascribe unique values to the parameters, one must apply a "constraint". With the "treatment contrasts" the constraint is that > beta_1 = 0. ...and consequently, being a constant, has an s.e. of 0. -- Peter