Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 12 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
12
Dung lượng
212,58 KB
Nội dung
Chapter 2 Building Tables ofData After completing this chapter, you will be able to: Understand the ADO.NET classes used to create tables Create strongly typed columns within a table Indicate the primary key for a table Design a table graphically or in code The focus of all data in ADO.NET is the table—or more correctly, the DataTable. This class, located at System.Data.DataTable, defines a single table in which strongly typed column definitions and runtime data rows appear. By itself, a DataTable isn’t very interesting; it’s just a memory-based repository for data. It becomes useful only when you start employing ADO.NET and standard .NET Framework methods and tools to process the data stored in each table and data row. Note Some of the exercises in this chapter use the same sample project, a tool that exposes the structure of a DataTable. Although you can run the application after each exercise, the expected results for the full application might not appear until you complete all related exercises in the chapter. Implementing Tables As with everything else in .NET, tables in ADO.NET exist as instantiated objects. Whether hand-written by you, produced by dragging and dropping items in the development envi- ronment, or generated by one of the Visual Studio tools, the ADO.NET code you include in your application exists to create and manage DataTable objects and other related objects. Logical and Physical Table Implementations ADO.NET’s DataTable object represents a logical implementation of a table of data. When you visualize the data values within the table, you have an image of a spreadsheet-like table, with distinct cells for each text, numeric, date/time, or other type of value. Dwonloaded from: iDATA.ws 18 The physical implementation of a DataTable object is somewhat different. Instead of one large grid layout, ADO.NET maintains tabular data as a collection of collections. Each DataTable object contains a collection of ordered rows, each existing as an instance of a DataRow object. Each row contains its own collection of items that holds the row’s (and ulti- mately the table’s) actual data values. A set of column definitions exists separately from the actual column values, although the definitions influence the values. Figure 2-1 shows the difference between the logical and physical structures of a data table. Logical Implementation Physical Implementation ID First Name Birth Date 0 11 George 8/3/1985 1 96 Annette 2/12/2003 Row 0 1 2 ID 11 96 27 First Name George Annette Toru Birth Date 8/3/1985 2/12/2003 12/30/1948 2 27 Toru 12/30/1948 FIGURE 2-1 Logical and physical table layouts. The DataTable Class The three main classes that make up a data table are DataTable, DataColumn, and DataRow. As expected, these classes define a table, its columns, and its data rows, respectively. The main discussion for the DataRow class appears in Chapter 3, “Storing Data in Memory.” To define a table, create a new DataTable object, optionally supplying a table name. C# System.Data.DataTable unnamedTable = new System.Data.DataTable(); System.Data.DataTable namedTable = new System.Data.DataTable("Customer"); Visual Basic Dim unnamedTable As New System.Data.DataTable() Dim namedTable As New System.Data.DataTable("Customer") Dwonloaded from: iDATA.ws Chapter 2 Building Tables ofData 19 After you create a DataTable, you can modify its TableName property and other relevant properties as needed. Note Both Visual Basic and C# include features that let you use namespace elements as if they were globally named elements. Visual Basic accomplishes this on a file-by-file basis with the Imports keyword; C# includes the Using keyword for the same purpose. Visual Basic also includes Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN BÀI TẬP LÂM SẢN NGOÀI GỖ Chọn cộng đồng mà có rừng để phân tích yếu tố xã hội, tài nguyên rừng, trạng quản lý tài nguyên rừng để phân tích vấn đề liên quan phát triển lâm sản gỗ theo hướng mang lại thu nhập cho người dân Nhóm – DH05LN Phan Thị Mỹ Dung Hoàng Mai Hương Nguyễn Văn Thiết Cao Duy Thuần Nguyễn Mạnh Quân GVHD: Th.s Nguyễn Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN LỜI NĨI ĐẦU Lâm sản ngồi gỗ (LSNG) đóng vai trò quan trọng sinh kế cho người dân nghèo vùng nơng thơn Đó nguồn lương thực, thuốc, vật liệu xây dựng mang lại thu nhập bổ sung cho người dân Thu nhập từ sản phẩm rừng dùng để mua hạt giống, thuê lao động canh tác tạo nguồn vốn cho hoạt động kinh doanh Đối với hộ nghèo hơn, LSNG đóng vai trò quan trọng việc cung cấp lương thực sinh kế chủ yếu Hơn việc sử dụng phát triển LSNG Việt Nam nói chung chưa có chiến lược lâu dài cụ thể, người dân tùy ý sử dụng LSNG rừng mà chưa biết hết giá trị sử dụng Vấn đề thách thức cho ngành Lâm nghiệp thống kê loài LSNG Việt Nam giá trị sử dụng nó, đồng thời hướng dẫn người dân sống xung quanh rừng khai thác sử dụng hợp lý LSNG để phát triển rừng kinh tế bền vững Nhóm định chọn thôn Đạ Nhar – huyện Đạ Tẻh – Lâm Đồng để phân tích yếu tố xã hội, tài nguyên thiên nhiên, trạng quản lý tài nguyên thiên nhiên, từ đưa giải pháp nhằm nâng cao đời sống cho đồng bào dân tộc thông qua LSNG Hiện nay, tình hình phát triển lâm sản ngồi gỗ thôn Đạ Nhar ngày cải thiện Đời sống người dân phần cải thiện Thực trạng nào, phân tích GVHD: Th.s Nguyễn Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN Các yếu tố xã hội: Thôn Đạ Nhar cách trung tâm huyện Đạ Tẻh 12km hướng Đơng Bắc, cách thành phố Hồ Chí Minh 160km, nằm vùng Nam Cao nguyên Đạ Nhar thôn nằm vùng đệm vườn quốc gia Cát Tiên, khu vực rừng xung yếu lưu vực sông Đồng Nai Do việc quản lý tài nguyên rừng vấn đề quan trọng có ảnh hưởng đến việc phòng hộ đầu nguồn sơng Đơng Nai Thơn Đạ Nhar hình thành từ năm 1985 theo sách định canh định cư, có bn nhỏ Dân số khoảng 200 hộ với gần 1100 nhân Là thôn nghèo xã Quốc Oai Thu nhập người dân sống chủ yếu từ canh tác nương rẫy thu hái LSNG rừng Trong năm 2001, theo thống kê xã Quốc Oai, thu nhập từ rừng người dân thôn Đạ Nhar 288 triệu đồng, chiếm 42% tổng thu nhập /năm, tre nứa 160triệu đồng/năm Trong thu nhập từ nơng nghiệp đạt 90triệu đồng /năm Thành phần dân tộc chủ yếu dân tộc Châu Mạ Trong năm gần đây, quyền địa phương tìm cách nâng cao đời sống cho người dân, có biện pháp nâng cao thu nhập dựa vào việc phát triển ngành nghề liên quan đến LSNG Trình độ hiểu biết người dân LSNG hạn chế, hầu hết biết phần công dụng lâm sản Do đó, việc phát triển kinh tế từ LSNG gỗ gặp nhiều khó khăn: thời gian tìm hiểu LSNG, phương thức kinh doanh, thị trường đầu cho sản phẩm Mặt khác, trình độ dân trí đồng bào dân tộc thấp nên gây khó khăn việc phổ biến kiến thức LSNG cho người dân Chính quyền địa phương năm qua ln tìm cách nâng cao đời sống cho người dân Một hướng cho phát triển kinh tế bền vững dựa vào LSNG Nói khơng có nghĩa khai thác LSNG mà khơng có biện pháp bảo vệ bảo tồn loài LSNG có giá trị kinh tế giá trị sử dụng cao Khai thác đơi với bảo vệ vừa nâng cao hiệu kinh tế mà nâng cao tính đa dạng sinh học khu vực GVHD: Th.s Nguyễn Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN Kiến thức địa đồng bào dân tộc khai thác chế biến lâm sản đa dạng phong phú Nhưng kiến thức địa LSNG sử dụng cho việc sản xuất dụng cụ đơn giản, sử dụng gia đình Chưa phát huy mạnh phát triển kinh tế Nâng cao thu nhập cho người dân thơng qua LSNG việc sử dụng kiến thức địa để tạo mặt hàng có tính thương phẩm, có tính cạnh tranh điều đặc biệt mang lại thu nhập cho người dân Hệ thống giao thông thôn chưa hồn thiện nên khó khăn việc vận chuyển LSNG xa, làm tăng chi phí giảm lợi nhuận Tài nguyên rừng: Tài nguyên rừng đa dạng, thực trạng Đạ Nhar đất ngày bị bạc màu Sau định cấm khai thác lâm sản phá rừng làm rẫy Nhà nước vào năm 1993 diện tích đất bị bỏ hoang lớn Ngoài gỗ lớn rừng Đạ Nhar có lượng lớn lồi LSNG với nhiều cơng dụng khác Các lồi làm thực phẩm: tre nứa, nhíp, ươi, mây…các làm hàng thủ công mỹ nghệ: mây, tre nứa…các làm dược liệu: nhân trần, thiên niên kiễng, sa nhân…bên cạnh đó, động vật rừng đa dạng thành phần loài Những loài LSNG chưa người dân quan tâm chăm sóc kỹ lưỡng Hiện người dân chưa quan tâm nhiều đến LSNG, nguồn LSNG dồi giúp cho người dân có nguồn thu nhập chỗ Người dân biết trồng số loại LSNG để phục vụ cho nhu cầu hàng ngày cuả người dân Họ dùng nguồn nguyên liệu để trao đổi bn bán tăng thêm thu nhập cho Ở họ dùng gỗ bụi làm củi đốt, tận dụng nguồn tài nguyên Các loại LSNG người dân sử dụng phân loại sau GVHD: Th.s Nguyễn Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LNNhóm LSNG cho thực phẩm có nguồn gốc từ thực vật: Chủ yếu loại măng, nấm, rau, đọt, ngọn, củ … loài sử dụng đòa phương Các loại tiêu biểu như: Măng loại (Bambusa spp): - Măng tre - Măng lồ ô - Măng nứa… Các loại nấm : - Nấm mối (Temitomy albupinosa) - Nấm tai mèo(Auricularia polytricha) Đọt ... Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine- readable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMs visit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America). Chapter 14. Statistical Description ofData 14.0 Introduction In this chapter and the next, the concept ofdata enters the discussion more prominently than before. Dataconsist of numbers, of course. Butthese numbers are fed intothecomputer, not produced by it. These are numbers to be treated with considerable respect, neither to be tampered with, nor subjected to a numerical process whose character you do not completely understand. You are well advised to acquire a reverence for data that is rather different from the “sporty” attitude that is sometimes allowable, or even commendable, in other numerical tasks. The analysis ofdata inevitably involves some trafficking with the field of statistics, that gray area which is not quite a branch of mathematics — and just as surely not quite a branch of science. In the following sections, you will repeatedly encounter the following paradigm: • apply some formula to the data to compute “a statistic” • compute where the value of that statistic falls in a probability distribution that is computed on the basis of some “null hypothesis” • if it falls in a very unlikely spot, way out on a tail of the distribution, conclude that the null hypothesis is false for your data set If a statistic falls in a reasonable part of the distribution, you must not make the mistake of concluding that the null hypothesis is “verified” or “proved.” That is the curse of statistics, that it can never prove things, only disprove them! At best, you can substantiate a hypothesis by ruling out, statistically, a whole long list of competing hypotheses, every one that has ever been proposed. After a while your adversaries and competitors will give up trying to think of alternative hypotheses, or else they will grow old and die, and then your hypothesis will become accepted. Sounds crazy, we know, but that’s how science works! In this book we make a somewhat arbitrary distinction between data analysis procedures that are model-independent and those that are model-dependent.Inthe former category, we include so-called descriptive statistics that characterize a data set in general terms: its mean, variance, and so on. We also include statistical tests that seek to establish the “sameness” or “differentness” of two or more data sets, or that seek to establish and measure a degree of correlation between two data sets. These subjects are discussed in this chapter. 609 610 Chapter 14. Statistical Description ofData Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine- readable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMs visit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North 610 Chapter 14. Statistical Description ofData Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine- readable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMs visit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America). In the other category, model-dependent statistics, we lump the whole subject of fitting data to a theory, parameter estimation, least-squares fits, and so on. Those subjects are introduced in Chapter 15. Section 14.1 deals with so-called measures of central tendency, the moments of a distribution,the median and mode. In §14.2 we learn to test whether different data sets are drawn from distributions with different values of these measures of central tendency. This leads naturally, in §14.3, to the more general question of whether two distributions can be shown to be (significantly) different. In §14.4–§14.7, we deal with measures of association for two distributions. We want to determine whether two variables are “correlated” or “dependent” on one another. If they are, we want to characterize the degree of correlation in some simple ways. The distinction between parametric and nonparametric (rank) methods is emphasized. Section 14.8 introduces the concept ofdata smoothing, and discusses the particular case of Savitzky-Golay smoothing filters. This chapter draws mathematically on the material on special functions that was presented in Chapter 6, especially §6.1–§6.4. You may wish, at this point, to review those sections. CITED REFERENCES AND FURTHER READING: Bevington, P.R. 1969, Data Reduction and Error Analysis for the Physical Sciences (New York: McGraw-Hill). Stuart, A., and Ord, J.K. 1987, Kendall’s Advanced Theory of Statistics , 5th ed. (London: Griffin and Co.) [previous eds. published as Kendall, M., and Stuart, A., The Advanced Theory of Statistics ]. Norusis, M.J. 1982, SPSS Introductory Guide: Basic Statistics and Operations ; and 1985, SPSS- X Advanced Statistics Guide (New York: McGraw-Hill). Dunn, O.J., and Clark, V.A. 1974, Applied Statistics: Analysis of Variance and Regression (New York: Wiley). 14.1 Moments of a Distribution: Mean, Variance, Skewness, and So Forth When aset of values has a sufficientlystrongcentral tendency, that is, a tendency to cluster around some particular value, then it may be useful to characterize the set by a few numbers that are related to its moments, the sums of integer powers of the values. Best known is the mean of the values x 1 , .,x N , x= 1 N N j=1 x j (14.1.1) which estimates the value around which central clustering occurs. Note the use of an overbar to denote the mean; angle brackets are an equally common notation,e.g., x. You should be aware that the mean is not the only available estimator of this 14.1 Moments of a Distribution: Mean, Variance, Skewness 611 Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine- readable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMs visit website http://www.nr.com or 14.2 Do Two Distributions Have the Same Means or Variances? 615 Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine- readable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMs visit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America). that this is wasteful, since it yields much more information than just the median (e.g., the upper and lower quartile points, the deciles, etc.). In fact, we saw in §8.5 that the element x (N+1)/2 can be located in of order N operations. Consult that section for routines. The mode of a probability distribution function p(x) is the value of x where it takes on amaximum value. The modeisuseful primarilywhenthereisa single, sharp maximum, in which case it estimates the central value. Occasionally, a distribution will be bimodal, with two relative maxima; then one may wish to know the two modes individually. Note that, in such cases, the mean and median are not very useful, since they will give only a “compromise” value between the two peaks. CITED REFERENCES AND FURTHER READING: Bevington, P.R. 1969, Data Reduction and Error Analysis for the Physical Sciences (New York: McGraw-Hill), Chapter 2. Stuart, A., and Ord, J.K. 1987, Kendall’s Advanced Theory of Statistics , 5th ed. (London: Griffin and Co.) [previous eds. published as Kendall, M., and Stuart, A., The Advanced Theory of Statistics ], vol. 1, § 10.15 Norusis, M.J. 1982, SPSS Introductory Guide: Basic Statistics and Operations ; and 1985, SPSS- X Advanced Statistics Guide (New York: McGraw-Hill). Chan, T.F., Golub, G.H., and LeVeque, R.J. 1983, American Statistician , vol. 37, pp. 242–247. [1] Cram´er, H. 1946, Mathematical Methods of Statistics (Princeton: Princeton University Press), § 15.10. [2] 14.2 Do Two Distributions Have the Same Means or Variances? Not uncommonly we want to know whether two distributions have the same mean. For example, a first set of measured values may have been gathered before some event, a second set after it. We want to know whether the event, a “treatment” or a “change in a control parameter,” made a difference. Our first thought is to ask “how many standard deviations” one sample mean is from the other. That number may in fact be a useful thing to know. It does relate to the strength or “importance” of a difference of means if that difference is genuine. However, by itself, it says nothing about whether the difference is genuine, that is, statistically significant. A difference of means can be very small compared to the standard deviation, and yet very significant, if the number ofdata points is large. Conversely, a difference may be moderately large but not significant, if the data are sparse. We will be meeting these distinct concepts of strength and significance several times in the next few sections. A quantity that measures the significance of a difference of means is not the number of standard deviations that they are apart, but the number of so-called standard errors that they are apart. The standard error of a set of values measures the accuracy with which the sample mean estimates the population (or “true”) mean. Typically the standard error is equal to the sample’s standard deviation divided by the square root of the number of points in the sample. 616 Chapter 14. Statistical Description ofData Sample page from NUMERICAL RECIPES IN C: THE ART OF SECTION 5 Indexof Expressions The numbers refer to the unit in which the idiom is taught. about It'll be all right on the night. 50 You've got to keep your wits about you. 47 It's all hands on deck. 6 accounts It's all in your mind. 39 By all accounts he's pretty good. 86 It's all over now, so go home. 86 acquainted It's all over your face. 26 I'm not very well acquainted with it. 60 It's all up in the air. 51 action It's all yours. 86 Actions speak louder than words. 113 Ifs been all go in the office today. 86 add It's been difficult all along the line. 44 It just doesn't add up. 63 It's open all year round. 86 That added more fuel to the fire. 28 N0t a^ ajj gg To add insult to injury, they didn't even say she.s on the g0 all day 83 thank you. 49, 109 There were flve of us all told 86 advantage They stopped aU 0f a sudden. 86 He's trying to take advantage of you. 54, 68 Wre all in the same boat 6 afford When all's said and done. 86 ^1 can't afford more than a week off. 1 you can>t wln them aU 50 You mustn't put all your eggs in one basket. 74 He s a man after my own heart. 34 . TT,n , I knew it all along. 86 We meet up now and again. 82 ., . . „ „ ambition You can say that again. 48 , . , , Her burning ambition was to be an actress. 28, age The golden age of drama. 38 It's unusual in this day and age. 82 ancient . " '"' That's ancient history now. 61 He's a breath of fresh air here. 52 and .(see Pa£es 188 ~ 191^ I felt as if I was walking on air. 66 angling It's all up in the air. 51 He's ang11^ for something. 29 We need to clear the air. 72 another aU It's been one thing after another. 83 By all accounts he's pretty good. 86 Tomorrow's another day. 50, 82 By all means help yourself. 86 You've got another think coming. 81 He was drunk, and to cap it all, he'd been ants drinking my wine. 109 He's got ants in his pants. 14 I knew it all along. 86 anything I want to get away from it all. 59 Don't take anything for granted. 47 I won't, if it's all the same to you. 86 He'll do anything for a quiet life. 70 I'll tell you once and for all. 40 apart I'm all at sea without her. 45 They're poles apart in sport. 75 I'm all fingers and thumbs. 27 arm I'm all for doing it now. 86 I'd give my right arm for that. 16 It was a good day all in all. 86 OK, twist my arm. 68 It wasn't all it's cracked up to be. 57 Private education costs an arm and a leg. 16, 64 245 arms Don't take your eye off the ball. 62 They are up in arms about it. 66 He's on the ball. 41 around I want to start the ball rolling. 78 He's always throwing his weight around. 68 It's a whole new ball game. 41, 75 arrive The ball's in their court. 41 He thinks he's really arrived. 4 They won't play ball. 41 aside They won't run with the ball. 41 I try to put a bit of money aside each month. 64 balloon asleep The joke went down like a lead balloon. 38 He's fast asleep. 76, 111 bang Sorry, I was half asleep. 76 You're banging your head against a brick wall. The baby's sound asleep. Ill 18,49 awake baptism It's late but I'm wide awake. Ill It was a baptism of fire. 28, 55 away bargain I want to get away from it all. 59 j picked up a bargain yesterday. 64 When the cat's away, the mice will play. 19 It was harder than I had bargained for. 81 awful bark I can't tell you - it's too awful for words. 113 His bark ls worse than his bite. 50 baby You're barking up the wrong tree. 62 Don't throw the baby out with the bath water. 47 barrel She's the baby of the family. 56 You're scraping the bottom of the barrel. 57 bachelor base Paul's a confirmed bachelor. 67 Fm going to touch base ... Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN Các yếu tố xã hội: Thôn Đạ Nhar cách trung tâm huyện Đạ Tẻh 12km hướng Đông Bắc, cách thành phố Hồ Chí Minh 160 km, nằm vùng Nam Cao nguyên Đạ Nhar... Nguyễn Quốc Bình Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN Nhóm LSNG cho thực phẩm có nguồn gốc từ động vật Các loại thú lớn - Heo rừng (Sus scrofa) - Chồn (Martes flavicula) Các loại thú nhỏ :... lương thực để sản xuất hàng hóa bán thị trường 60 50 40 nông sản qlbvr 30 NTFP 20 khác 10 GVHD: Th.s Nguyễn Quốc Bình 10 Bài Tập Lâm Sản Ngồi Gỗ Nhóm - DH05LN Qua biểu đồ ta dễ thấy phụ thuộc vào